'Reconfigures the scheduler with the given options. Can only be done when the scheduler isn\'t running.
:param dict gconfig: a "global" configuration dictionary whose values can be overridden by keyword arguments to
this method
:param str|unicode prefix: pick only those keys from ``gconfig`` that are prefixed with this string
(pass an empty string or ``None`` to use all keys)
:raises SchedulerAlreadyRunningError: if the scheduler is already running'

def configure(self, gconfig={}, prefix='apscheduler.', **options):

    if self.running:
        raise SchedulerAlreadyRunningError
    if prefix:
        prefixlen = len(prefix)
        gconfig = dict(((key[prefixlen:], value) for (key, value) in six.iteritems(gconfig) if key.startswith(prefix)))
    config = {}
    for (key, value) in six.iteritems(gconfig):
        parts = key.split('.')
        parent = config
        key = parts.pop(0)
        while parts:
            parent = parent.setdefault(key, {})
            key = parts.pop(0)
        parent[key] = value
    config.update(options)
    self._configure(config)
