Where did you call your item_width_cols_to_class
“function”?
You are using the function as a method inside the My_Widget
class. Therefore, you have to call it with a reference to its non-existent object e.g. $this->item_width_cols_to_class()
or self::item_width_cols_to_class()
(static).