import re


def convert_to_snake_case(value: str) -> str:
    """
    Convert the value from CamelCase to snake_case.
    Regex from: https://github.com/jpvanhal/inflection/blob/0.5.1/inflection/__init__.py#L397
    """

    value = re.sub(r"([A-Z]+)([A-Z][a-z])", r"\1_\2", value)
    value = re.sub(r"([a-z\d])([A-Z])", r"\1_\2", value)
    value = value.replace("-", "_")
    return value.lower()