def filetype(mode):
 if stat.S_ISLNK(mode):
  return 'link'
 elif stat.S_ISDIR(mode):
  return 'dir'
 elif stat.S_ISREG(mode):
  return 'file'
 else:
  return 'unknown'

def filetype ( mode ) : if stat . S_ISLNK ( mode ) : return 'link' elif stat . S_ISDIR ( mode ) : return 'dir' elif stat . S_ISREG ( mode ) : return 'file' else : return 'unknown'
returns "dir" or "file" according to what type path is .