code: def package_name(package):
      # type: (str) -> str
      
      if not package:
          return ""
  
      lastdot = package.rfind(".")
      if lastdot == -1:
          return package
  
      return package[:lastdot]
docs: Returns the package name of the given module name