from datetime import datetime


def parse_date(date_str):
    """Turns a report date from the FEC disclosures into a Python datetime"""
    try:
        return datetime.strptime(date_str, '%Y-%m-%dT%H:%M:%S')
    except ValueError:
        try:
            return datetime.strptime(date_str, '%Y-%m-%dT%H:%M:%S.%f')
        except ValueError:
            raise ValueError('Error converting "%s".' % date_str)