def isreadable(f):
 if ((not six.PY2) and hasattr(f, 'readable')):
  return f.readable()
 if (hasattr(f, 'closed') and f.closed):
  raise ValueError('I/O operation on closed file')
 if (not hasattr(f, 'read')):
  return False
 if (hasattr(f, 'mode') and (not any(((c in f.mode) for c in 'r+')))):
  return False
 return True

def isreadable ( f ) : if ( ( not six . PY2 ) and hasattr ( f , 'readable' ) ) : return f . readable ( ) if ( hasattr ( f , 'closed' ) and f . closed ) : raise ValueError ( 'I/O operation on closed file' ) if ( not hasattr ( f , 'read' ) ) : return False if ( hasattr ( f , 'mode' ) and ( not any ( ( ( c in f . mode ) for c in 'r+' ) ) ) ) : return False return True
returns true if the file-like object can be read from .