def find_configured_repository(name):
parser = configparser.RawConfigParser()<EOL>for config_file in [SYSTEM_CONFIG_FILE, USER_CONFIG_FILE]:<EOL><INDENT>config_file = parse_path(config_file)<EOL>if os.path.isfile(config_file):<EOL><INDENT>logger.debug("<STR_LIT>", format_path(config_file))<EOL>parser.read(config_file)<EOL><DEDENT><DEDENT>matching_repos = [r for r in parser.sections() if normalize_name(name) == normalize_name(r)]<EOL>if not matching_repos:<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise NoSuchRepositoryError(msg % name)<EOL><DEDENT>elif len(matching_repos) != <NUM_LIT:1>:<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise AmbiguousRepositoryNameError(msg % (name, concatenate(map(repr, matching_repos))))<EOL><DEDENT>else:<EOL><INDENT>kw = {}<EOL>options = dict(parser.items(matching_repos[<NUM_LIT:0>]))<EOL>vcs_type = options.get('<STR_LIT:type>', '<STR_LIT>').lower()<EOL>local_path = options.get('<STR_LIT>')<EOL>if local_path:<EOL><INDENT>kw['<STR_LIT>'] = parse_path(local_path)<EOL><DEDENT>bare = options.get('<STR_LIT>', None)<EOL>if bare is not None:<EOL><INDENT>kw['<STR_LIT>'] = coerce_boolean(bare)<EOL><DEDENT>for name in '<STR_LIT>', '<STR_LIT>', '<STR_LIT>':<EOL><INDENT>value = options.get(name)<EOL>if value is not None:<EOL><INDENT>kw[name.replace('<STR_LIT:->', '<STR_LIT:_>')] = value<EOL><DEDENT><DEDENT>return repository_factory(vcs_type, **kw)<EOL><DEDENT>
Find a version control repository defined by the user in a configuration file.

:param name: The name of the repository (a string).
:returns: A :class:`Repository` object.
:raises: :exc:`~vcs_repo_mgr.exceptions.NoSuchRepositoryError` when the
         given repository name doesn't match any of the configured
         repositories.
:raises: :exc:`~vcs_repo_mgr.exceptions.AmbiguousRepositoryNameError`
         when the given repository name is ambiguous (i.e. it matches
         multiple repository names).
:raises: :exc:`~vcs_repo_mgr.exceptions.UnknownRepositoryTypeError` when
         a repository definition with an unknown type is encountered.

The following configuration files are supported:

1. ``/etc/vcs-repo-mgr.ini``
2. ``~/.vcs-repo-mgr.ini``

Repositories defined in the second file override repositories defined in
the first. Here is an example of a repository definition:

.. code-block:: ini

   [vcs-repo-mgr]
   type = git
   local = ~/projects/vcs-repo-mgr
   remote = git@github.com:xolox/python-vcs-repo-mgr.git
   bare = true
   release-scheme = tags
   release-filter = .*

Three VCS types are currently supported: ``hg`` (``mercurial`` is also
accepted), ``git`` and ``bzr`` (``bazaar`` is also accepted).