'Configure a formatter from a dictionary.'

def configure_formatter(self, config):

    if ('()' in config):
        factory = config['()']
        try:
            result = self.configure_custom(config)
        except TypeError as te:
            if ("'format'" not in str(te)):
                raise
            config['fmt'] = config.pop('format')
            config['()'] = factory
            result = self.configure_custom(config)
    else:
        fmt = config.get('format', None)
        dfmt = config.get('datefmt', None)
        result = logging.Formatter(fmt, dfmt)
    return result
