code: def script_folder(script_path):
      
      # There exist modules whose __file__ attribute does not correspond directly
      # to a disk file, e.g. modules imported from inside zip archives.
      if os.path.isfile(script_path):
          return _rel_path(os.path.dirname(script_path)) or "."
docs: Return the given script's folder or None if it can not be determined.
  
      Script is identified by its __file__ attribute. If the given __file__
      attribute value contains no path information, it is expected to identify an
      existing file in the current working folder.
  
      Returned folder may be specified relative to the current working folder
      and, if determined, will never be an empty string.
  
      Typical use case for calling this function is from a regular stand-alone
      script and not a frozen module or a module imported from the disk, a
      zip-file, an external database or any other such source. Such callers can
      safely assume they have a valid __file__ attribute available.