code: def obj_2_str(obj, tg_type=None):
      
      if tg_type is None:
          return obj
      if tg_type in _scalar_types:
          # scalar cases
          if is_pure_str(obj):
              return obj
          elif is_non_str_seq(obj):
              if not len(obj):
                  return ""
              obj = obj[0]
          return str(obj)
      # sequence cases
      if obj is None:
          return ''
      return '\n'.join([str(i) for i in obj])
docs: Converts a python object into a string according to the given tango type
  
             :param obj: the object to be converted
             :type obj: :py:obj:`object`
             :param tg_type: tango type
             :type tg_type: :class:`tango.CmdArgType`
             :return: a string representation of the given object
             :rtype: :py:obj:`str`