'Checks whether the token matches the given arguments.
*ttype* is a token type. If this token doesn\'t match the given token
type.
*values* is a list of possible values for this token. The values
are OR\'ed together so if only one of the values matches ``True``
is returned. Except for keyword tokens the comparison is
case-sensitive. For convenience it\'s ok to pass in a single string.
If *regex* is ``True`` (default is ``False``) the given values are
treated as regular expressions.'

def match(self, ttype, values, regex=False):

    type_matched = (self.ttype is ttype)
    if ((not type_matched) or (values is None)):
        return type_matched
    if isinstance(values, string_types):
        values = (values,)
    if regex:
        flag = (re.IGNORECASE if self.is_keyword else 0)
        values = (re.compile(v, flag) for v in values)
        for pattern in values:
            if pattern.search(self.normalized):
                return True
        return False
    if self.is_keyword:
        values = (v.upper() for v in values)
    return (self.normalized in values)
