def check_validation(validation):
    """
    Checks that the given validation string compiles successfully.

    :param validation:
    :return str: The validation pattern, if compilation succeeds
    """

    try:
        compiled = re.compile(validation)
    except re.error as e:
        raise InvalidConfiguration(f"Validation {validation} couldn't compile. Reason: {e}")

    return compiled.pattern

    Checks that the given validation string compiles successfully.

    :param validation:
    :return str: The validation pattern, if compilation succeeds
    
lemur/common/utils.py