def _parse_expires(expires):
    """ Parse the 'expires' attribute, guessing what format it is in and
        returning a datetime
    """
    # none is used to signify positive infinity
    if expires is None or expires in ('never', 'infinity'):
        return 'infinity'

    try:
        return dateutil.parser.parse(str(expires))
    except __HOLE__ as exc:
        pass

    try:
        # use parsedatetime for "human readable" time specs
        exp = pdt.parse(expires)[0]
        # and convert to datetime
        return datetime.datetime.fromtimestamp(time.mktime(exp))
    except ValueError as exc:
        pass

    raise NipapValueError("Invalid date specification for expires")
dataset/ETHPy150Open SpriteLink/NIPAP/nipap/nipap/backend.py/_parse_expires