from datetime import datetime


def str_to_datetime(s):
    """
    Parse ISO datetime string and return a datetime object

    :param str s: date/time string

    :return: datetime object, None if not a valid date/time string
    :rtype: datetime.datetime | None
    """
    t = None
    for fmt in ('%Y-%m-%dT%H:%M:%S.%f', '%Y-%m-%dT%H:%M:%S',
                '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M:%S', '%Y-%m-%d'):
        try:
            t = datetime.strptime(s, fmt)
        except ValueError:
            pass
        else:
            break
    return t