<commit_before>"""
Apache Utils.

Tools for dealing with credential checking from X509 SSL certificates.
These are useful when using Apache as a reverse proxy to check user
credentials against a local DB.
"""
from collections import namedtuple
import cherrypy
from sqlalchemy_utils import create_db, db_session
from tables import Users

VerifiedUser = namedtuple('VerifiedUser', ('id', 'dn', 'ca', 'admin'))


def apache_client_convert(client_dn, client_ca=None):
    """
    Convert Apache style client certs.

    Convert from the Apache comma delimited style to the
    more usual slash delimited style.

    Args:
        client_dn (str): The client CLIENT_DN
        client_ca (str): [Optional] The client CA

    Returns:
        tuple: The converted client (DN, CA)
    """
    client_dn = '/' + '/'.join(reversed(client_dn.split(',')))<commit_msg>Update apache_utils.py<commit_after>"""
Apache Utils.

Tools for dealing with credential checking from X509 SSL certificates.
These are useful when using Apache as a reverse proxy to check user
credentials against a local DB.
"""
from collections import namedtuple
import cherrypy
from sqlalchemy_utils import create_db, db_session
from tables import Users

VerifiedUser = namedtuple('VerifiedUser', ('id', 'dn', 'ca', 'admin'))


def apache_client_convert(client_dn, client_ca=None):
    """
    Convert Apache style client certs.

    Convert from the Apache comma delimited style to the
    more usual slash delimited style.

    Args:
        client_dn (str): The client DN
        client_ca (str): [Optional] The client CA

    Returns:
        tuple: The converted client (DN, CA)
    """
    client_dn = '/' + '/'.join(reversed(client_dn.split(',')))
{'fraction_non_alphanumeric': 0.09170560747663552, 'fraction_numerical': 0.0035046728971962616, 'mean_word_length': 3.9083094555873927, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3365910', 'n_tokens_mistral': 508, 'n_tokens_neox': 474, 'n_words': 190}