def _cls_lookup_dist(cls):
    """
    Attempt to resolve the distribution from the provided class in the
    most naive way - this assumes the Python module path to the class
    contains the name of the package that provided the module and class.
    """

    frags = cls.__module__.split('.')
    for name in ('.'.join(frags[:x]) for x in range(len(frags), 0, -1)):
        dist = find_pkg_dist(name)
        if dist:
            return dist
Attempt to resolve the distribution from the provided class in the
    most naive way - this assumes the Python module path to the class
    contains the name of the package that provided the module and class.