from ntpath import split, basename


def path_leave(path, **kwargs):
  """
  Extract a file name from a whole 
  path. 
  
  Parameters
  ----------
  path : str 
    Path including the file name.
    
  Returns
  -------
  file_name : str
    Extracted file name.
  
  Notes
  -----
  ntpath.split:
   Return tuple (head, tail) where tail is everything after the final slash. 
    Either part may be empty. 
  
  ntpath.basename:
   Return final component of a pathname
  
  """
  
  head, tail = split(path)
  
  # if tail is empty, return last component of head:
  return tail or basename(head)