def fileobj_is_binary(f):
 if hasattr(f, 'binary'):
  return f.binary
 if ((io is not None) and isinstance(f, io.TextIOBase)):
  return False
 mode = fileobj_mode(f)
 if mode:
  return ('b' in mode)
 else:
  return True

def fileobj_is_binary ( f ) : if hasattr ( f , 'binary' ) : return f . binary if ( ( io is not None ) and isinstance ( f , io . TextIOBase ) ) : return False mode = fileobj_mode ( f ) if mode : return ( 'b' in mode ) else : return True
returns true if the give file or file-like object has a file open in binary mode .