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(unicode(expires))
    except ValueError 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")
def _parse_expires ( expires ) : if expires is None or expires in ( 'never' , 'infinity' ) : return 'infinity' try : return dateutil . parser . parse ( unicode ( expires ) ) except ValueError as exc : pass try : exp = pdt . parse ( expires ) [ 0 ] return datetime . datetime . fromtimestamp ( time . mktime ( exp ) ) except ValueError as exc : pass raise NipapValueError ( "Invalid date specification for expires" )
Parse the 'expires' attribute, guessing what format it is in and
        returning a datetime