def configure(backends, raise_errors=False):
good_backends = []<EOL>for backend in backends:<EOL><INDENT>clspath = backend['<STR_LIT:class>']<EOL>options = backend.get('<STR_LIT>', {})<EOL>if isinstance(clspath, str):<EOL><INDENT>modpath, clsname = split_clspath(clspath)<EOL>try:<EOL><INDENT>__import__(modpath)<EOL>module = sys.modules[modpath]<EOL>cls = getattr(module, clsname)<EOL><DEDENT>except Exception:<EOL><INDENT>logger.exception('<STR_LIT>', clspath)<EOL>if raise_errors:<EOL><INDENT>raise<EOL><DEDENT>continue<EOL><DEDENT><DEDENT>else:<EOL><INDENT>cls = clspath<EOL><DEDENT>try:<EOL><INDENT>good_backends.append(cls(options))<EOL><DEDENT>except Exception:<EOL><INDENT>logger.exception(<EOL>'<STR_LIT>',<EOL>clspath,<EOL>options<EOL>)<EOL>if raise_errors:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>_change_metrics(good_backends)<EOL>
Instantiate and configures backends.

    :arg list-of-dicts backends: the backend configuration as a list of dicts where
        each dict specifies a separate backend.

        Each backend dict consists of two things:

        1. ``class`` with a value that is either a Python class or a dotted
           Python path to one

        2. ``options`` dict with options for the backend in question to
           configure it

        See the documentation for the backends you're using to know what is
        configurable in the options dict.

    :arg raise_errors bool: whether or not to raise an exception if something
        happens in configuration; if it doesn't raise an exception, it'll log
        the exception

    For example, this sets up a
    :py:class:`markus.backends.logging.LoggingMetrics` backend::

        markus.configure([
            {
                'class': 'markus.backends.logging.LoggingMetrics',
                'options': {
                    'logger_name': 'metrics'
                }
            }
        ])


    You can set up as many backends as you like.

    .. Note::

       During application startup, Markus should get configured before the app
       starts generating metrics. Any metrics generated before Markus is
       configured will get dropped.

       However, anything can call :py:func:`markus.get_metrics` and get a
       :py:class:`markus.main.MetricsInterface` before Markus has been
       configured including at module load time.