import pkg_resources


def load_entry_point(app, entry_point):
    """Load an object registered under an entry point

    In:
      - ``app`` -- name of the object
      - ``entry_point`` -- name of the entry_point

    Return:
      - (the object, the distribution of the object)
    """
    apps = {entry.name: entry for entry in pkg_resources.iter_entry_points(entry_point)}
    entry_point = apps.get(app)

    return (entry_point.load(), entry_point.dist) if entry_point else (None, None)