def sort_manual_keys(*sorted_keys):
    """Create a key function that sorts the given keys first."""
    _key_order = []
    for key in sorted_keys:
        if hasattr(key, 'lower'):
            key = key.lower()
        _key_order.append(key)

    def key_fn(key):
        if hasattr(key, 'lower'):
            key = key.lower()

        for i, sorted_key in enumerate(_key_order):
            if key == sorted_key:
                return '{}_{}'.format(i, key)

        return '{}_{}'.format(len(_key_order), key)

    return key_fn