def is_valid(identifier):
    """
    If the identifier is valid for Python, return True, otherwise False.
    """

    return (
        isinstance(identifier, six.string_types)
        and bool(NAME_RE.search(identifier))
        and not keyword.iskeyword(identifier)
    )
If the identifier is valid for Python, return True, otherwise False.