<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def package_name(package):
 # type: (str) -> str """ Returns the package name of the given module name """

    if not package:
        return ""

    lastdot = package.rfind(".")
    if lastdot == -1:
        return package

    return package[:lastdot]