import six
import re


def isidentifier(s):
    """
    Check whether the given string can be used as a Python identifier.
    """
    if six.PY2:
        return re.match("[_A-Za-z][_a-zA-Z0-9]*$", s)
    return s.isidentifier()