def match_part(string, part):
if not string or not re.match('<STR_LIT>' + PARTS[part] + '<STR_LIT>', string):<EOL><INDENT>raise ValueError('<STR_LIT>'.format(part, PARTS[part]))<EOL><DEDENT>
Raise an exception if string doesn't match a part's regex

    :param string: str
    :param part: a key in the PARTS dict
    :raises: ValueError, TypeError