def transformed_equal(name, key):
    """ Return True if ``name`` can be mapped to the transformed ``key`` such that ``key`` is a valid
    python identifier.

    The following transformation of ``key`` will be considered:
        ' '     ==>  '_'
        '-'     ==>  '_'
        '.'     ==>  '_'
        '[0-9]' ==> _[0-9]
    """
    key_transformed = key.replace(' ', '_').replace('-', '_').replace('.', '_')
    if key_transformed[0].isdigit():
        key_transformed = '_' + key_transformed
    return key_transformed == name