def _get_year(name):
    if name is None or name == '':
        raise Exception

    if len(name.split(' ')) == 1:
        return (name, None)

    for pattern in year_extract_patterns:
        match = re.match(pattern, name)
        if match is not None:
            year = match.group('year')
            if int(year) >= 1900:
                return (str(match.group('name')), int(year))

    return (name, None)
dataset/ETHPy150Open divijbindlish/movienamer/movienamer/sanitize.py/_get_year/original