def package_name(package):
    """
    Returns the package name of the given module name
    """
    if not package:
        return ''
    lastdot = package.rfind('.')
    if lastdot == -1:
        return package
    return package[:lastdot]
