def METHOD_NAME(attr):
    if isinstance(attr, ET.Element):
        attr = attr.text
    attr = attr.upper()
    match = VALID_DATE.match(attr)
    if not match:
        raise ValueError("Invalid datetime string: " + attr)
    check_decimal = attr.split('.')
    if len(check_decimal) > 1:
        decimal_str = ""
        for digit in check_decimal[1]:
            if digit.isdigit():
                decimal_str += digit
            else:
                break
        if len(decimal_str) > 6:
            attr = attr.replace(decimal_str, decimal_str[0:6])
    date_obj = isodate.parse_datetime(attr)
    test_utc = date_obj.utctimetuple()
    if test_utc.tm_year > 9999 or test_utc.tm_year < 1:
        raise OverflowError("Hit max or min date")
    return date_obj