def find_entrypoint(group, name, compat=True, required=False):
if group is None or (compat and '<STR_LIT::>' in name):<EOL><INDENT>try:<EOL><INDENT>return pkg_resources.EntryPoint.parse("<STR_LIT>" + name).load(False)<EOL><DEDENT>except (ImportError, pkg_resources.UnknownExtra) as exc:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for ep in pkg_resources.iter_entry_points(group, name):<EOL><INDENT>try:<EOL><INDENT>return ep.load()<EOL><DEDENT>except (ImportError, pkg_resources.UnknownExtra):<EOL><INDENT>continue<EOL><DEDENT><DEDENT><DEDENT>if required:<EOL><INDENT>raise ImportError("<STR_LIT>" % (group, name))<EOL><DEDENT>return None<EOL>
Finds the first available entrypoint with the given name in the
given group.

:param group: The entrypoint group the name can be found in.  If
              None, the name is not presumed to be an entrypoint.
:param name: The name of the entrypoint.
:param compat: If True, and if the name parameter contains a ':',
               the name will be interpreted as a module name and
               an object name, separated by a colon.  This is
               provided for compatibility.
:param required: If True, and no corresponding entrypoint can be
                 found, an ImportError will be raised.  If False
                 (the default), None will be returned instead.

:returns: The entrypoint object, or None if one could not be
          loaded.