import re


def is_legal_identifier(s):
    """
    Check if a string is a legal Python identifier.
    Parameters:
        s: the string to check
    Dependencies:
        modules: re
    """
    return re.search('^[A-Za-z_][A-Za-z0-9_]*$', s) is not None