def guess_filename(obj):
 name = getattr(obj, 'name', None)
 if (name and isinstance(name, builtin_str) and (name[0] != '<') and (name[(-1)] != '>')):
  return os.path.basename(name)

def guess_filename ( obj ) : name = getattr ( obj , 'name' , None ) if ( name and isinstance ( name , builtin_str ) and ( name [ 0 ] != '<' ) and ( name [ ( - 1 ) ] != '>' ) ) : return os . path . basename ( name )
tries to guess the filename of the given object .