code: def identify(path_name, *, override=None, check_exists=True, default=ISDIR):
      
  
      head, tail = os.path.split(path_name)
  
      if check_exists and os.path.exists(path_name):
          if os.path.isfile(path_name):
              if override == ISDIR:
                  raise ValueError("Cannot override a path as a directory if it "
                                   "is a file that already exists")
              result = ISFILE
          elif os.path.isdir(path_name):
              if override == ISFILE:
                  raise ValueError("Cannot override a path as a file if it is "
                                   "a directory that already exists")
              result = ISDIR
          else:
              raise Exception("Path exists but isn't a file or a directory...")
      elif not tail:
          if override == ISFILE:
              raise ValueError("Cannot interpret a path with a slash at the end "
                               "to be a file")
          result = ISDIR
      elif has_ext(tail, if_all_ext=True):
          if override is None:
              result = ISFILE
          else:
              result = override
      else:
          if override is None:
              result = default
          else:
              result = override
  
      return result
docs: Identify the type of a given path name (file or directory). If check_exists
      is specified to be false, then the function will not set the identity based
      on the path existing or not. If override is specified as either ISDIR or
      ISFILE, then the function will try its best to over-ride the identity to be
      what you have specified. The 'default' parameter is what the function will
      default the identity to if 'override' is not specified, and the path looks
      like it could be both a directory and a file.