def issubpackage(package, parents):
    if isinstance(parents, str):
        parents = (parents,)
    return len(parents) > 0 and reduce(
        bool.__or__,
        [parent == ".".join(package.split(".")[:len(parts)])
            for parent, parts in [(parent, parent.split("."))
                for parent in parents]],
        False)
dataset/ETHPy150Open skibblenybbles/django-commando/commando/management/base.py/issubpackage/original