'Returns the (entry_point, protocol) for the with the given
``name``.'

def find_egg_entry_point(self, object_type, name=None):

    if (name is None):
        name = 'main'
    possible = []
    for protocol_options in object_type.egg_protocols:
        for protocol in protocol_options:
            pkg_resources.require(self.spec)
            entry = pkg_resources.get_entry_info(self.spec, protocol, name)
            if (entry is not None):
                possible.append((entry.load(), protocol, entry.name))
                break
    if (not possible):
        dist = pkg_resources.get_distribution(self.spec)
        raise LookupError(('Entry    point    %r    not    found    in    egg    %r    (dir:    %s;    protocols:    %s;    entry_points:    %s)' % (name, self.spec, dist.location, ',    '.join(_flatten(object_type.egg_protocols)), ',    '.join(_flatten(([list((pkg_resources.get_entry_info(self.spec, prot, name) or {}).keys()) for prot in protocol_options] or '(no    entry    points)'))))))
    if (len(possible) > 1):
        raise LookupError(('Ambiguous    entry    points    for    %r    in    egg    %r    (protocols:    %s)' % (name, self.spec, ',    '.join(_flatten(protocol_options)))))
    return possible[0]
