<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _generate_exact_author_query(self, author_name_or_bai):
 """Generates a term query handling authors and BAIs. Notes: If given value is a BAI, search for the provided value in the raw field variation of `ElasticSearchVisitor.AUTHORS_BAI_FIELD`. Otherwise, the value will be procesed in the same way as the indexed value (i.e. lowercased and normalized (inspire_utils.normalize_name and then NFKC normalization). E.g. Searching for 'Smith, J.' is the same as searching for: 'Smith, J', 'smith, j.', 'smith j', 'j smith', 'j. smith', 'J Smith', 'J. Smith'. """

        if ElasticSearchVisitor.BAI_REGEX.match(author_name_or_bai):
            bai = author_name_or_bai.lower()
            query = self._generate_term_query(
                '.'.join((ElasticSearchVisitor.AUTHORS_BAI_FIELD, FieldVariations.search)),
                bai
            )
        else:
            author_name = normalize('NFKC', normalize_name(author_name_or_bai)).lower()
            query = self._generate_term_query(
                ElasticSearchVisitor.KEYWORD_TO_ES_FIELDNAME['exact-author'],
                author_name
            )

        return generate_nested_query(ElasticSearchVisitor.AUTHORS_NESTED_QUERY_PATH, query)