def is_string_like(obj):
 if isinstance(obj, (str, unicode)):
  return True
 if ma.isMaskedArray(obj):
  if ((obj.ndim == 0) and (obj.dtype.kind in 'SU')):
   return True
  else:
   return False
 try:
  (obj + '')
 except (TypeError, ValueError):
  return False
 return True

def is_string_like ( obj ) : if isinstance ( obj , ( str , unicode ) ) : return True if ma . isMaskedArray ( obj ) : if ( ( obj . ndim == 0 ) and ( obj . dtype . kind in 'SU' ) ) : return True else : return False try : ( obj + '' ) except ( TypeError , ValueError ) : return False return True
return true if *obj* looks like a string .