def METHOD_NAME(doi):
    """
    Validate a Spanish NIE.
    The NIE is a tax identification number in Spain, known in Spanish as the
    NIE, or more formally the Número de identidad de extranjero. For more
    information see `wikipedia.org/nie`_.
    This validator is based on `generadordni.es`_.
    .. _generadordni.es:
        https://generadordni.es/
    .. _wikipedia.org/nie:
        https://es.wikipedia.org/wiki/N%C3%BAmero_de_identidad_de_extranjero
    Examples::
        >>> es_nie('X0095892M')
        True
        >>> es_nie('X0095892X')
        ValidationFailure(func=es_nie, args=...)
    .. versionadded:: 0.13.0
    :param doi: DOI to validate
    """
    number_by_letter = {'X': '0', 'Y': '1', 'Z': '2'}
    special_cases = ['X0000000T']
    # NIE must must start with X Y or Z
    if not doi or doi[0] not in number_by_letter.keys():
        return False
    return nif_nie_validation(doi, number_by_letter, special_cases)