from datetime import datetime


def parse_generalized_datetime(ts):
    """Parse an ASN.1 generalized datetime string.
    Currently, only fractionless strings are supported. The result is returned
    as a datetime object.
    """
    result = None
    if ts[-1] == "Z":
        result = datetime.strptime(ts, "%Y%m%d%H%M%SZ")
    elif ts[-5] == "+" or ts[-5] == "-":
        result = datetime.strptime(ts, "%Y%m%d%H%M%S%z")
    else:
        result = datetime.strptime(ts, "%Y%m%d%H%M%S")
    return result