code: def packageRootPath(path):
      
      path = nstr(path)
      if os.path.isfile(path):
          path = os.path.dirname(path)
  
      parts = os.path.normpath(path).split(os.path.sep)
      package_parts = []
  
      for i in range(len(parts), 0, -1):
          filename = os.path.sep.join(parts[:i] + ['__init__.py'])
  
          if not os.path.isfile(filename):
              break
  
          package_parts.insert(0, parts[i - 1])
  
      if not package_parts:
          return path
      return os.path.abspath(os.path.sep.join(parts[:-len(package_parts)]))
docs: Returns the root file path that defines a Python package from the inputted
      path.
      
      :param      path | <str>
      
      :return     <str>