import re


def camel_to_snake_case(name):
    """Transfer camelCaseNames to snake_case_names.

    >>> camel_to_snake_case('camelCaseNameAllowed')
    'camel_case_name_allowed'
    >>> camel_to_snake_case('longVATNumber')
    'long_vat_number'
    """

    inbetween = re.compile(r'''
                            (
                             (?<=[a-z])                 # between a lowercase and
                             (?=[A-Z])                  # an uppercase letter
                             |                          # or
                             (?<=[A-Z])                 # in front of an uppercase
                             (?=[A-Z][a-z])             # followed by a lowercase 
                            )
                            ''', re.VERBOSE)
    return inbetween.sub(r'_', name).lower()