def verify_operator(operator):
    """
    Checks that ``operator`` is one of the allowed strings.
    Legal operators include the following strings:

    - '='
    - '<='
    - '>='
    - '<'
    - '>'
    - '<>'
    - 'like'
    - 'regexp'
    - 'is null'
    - 'is not null'

    EXAMPLES::

        sage: from sage.databases.sql_db import verify_operator
        sage: verify_operator('<=')
        True
        sage: verify_operator('regexp')
        True
        sage: verify_operator('is null')
        True
        sage: verify_operator('not_an_operator')
        Traceback (most recent call last):
        ...
        TypeError: not_an_operator is not a legal operator.
    """
    binaries = ['=', '<=', '>=', 'like', '<', '>', '<>', 'regexp']
    unaries = ['is null', 'is not null']
    if operator not in binaries and operator not in unaries:
        raise TypeError('%s is not a legal operator.' % operator)
    return True
