def _prefixed_config(config, prefix):
    """Returns a dictionary containing only items from the supplied dictionary `config` which start with `prefix`, also
    converting the key to lowercase and removing that prefix from it.

        _prefixed_config({'ONE': 1, 'MYPREFIX_TWO': 2}, 'MYPREFIX_') == {'two': 2}
    """
    result = {}
    for k, v in config.items():
        if k.startswith(prefix):
            result[k[len(prefix):].lower()] = v
    return result