def is_file(file_to_test):
 return all((hasattr(file_to_test, method) for method in ['read', 'name']))

def is_file ( file_to_test ) : return all ( ( hasattr ( file_to_test , method ) for method in [ 'read' , 'name' ] ) )
check if a path exists .