<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> import time <EOL> import datetime <EOL> __virtualname__ = '<STR_LIT>' <EOL> def __virtual__ ( ) : <EOL> if '<STR_LIT>' not in __salt__ : <EOL> return False <EOL> return __virtualname__ <EOL> def valid_certificate ( <EOL> name , <EOL> weeks = <NUM_LIT:0> , <EOL> days = <NUM_LIT:0> , <EOL> hours = <NUM_LIT:0> , <EOL> minutes = <NUM_LIT:0> , <EOL> seconds = <NUM_LIT:0> , <EOL> ) : <EOL> '''<STR_LIT>''' <EOL> ret = { '<STR_LIT:name>' : name , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT:result>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> now = time . time ( ) <EOL> cert_info = __salt__ [ '<STR_LIT>' ] ( name ) <EOL> if now < cert_info [ '<STR_LIT>' ] : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return ret <EOL> if now > cert_info [ '<STR_LIT>' ] : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return ret <EOL> delta_remaining = datetime . timedelta ( seconds = cert_info [ '<STR_LIT>' ] - now ) <EOL> delta_kind_map = { <EOL> '<STR_LIT>' : weeks , <EOL> '<STR_LIT>' : days , <EOL> '<STR_LIT>' : hours , <EOL> '<STR_LIT>' : minutes , <EOL> '<STR_LIT>' : seconds , <EOL> } <EOL> delta_min = datetime . timedelta ( ** delta_kind_map ) <EOL> if delta_remaining < delta_min : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( delta_remaining , delta_min ) <EOL> return ret <EOL> ret [ '<STR_LIT:result>' ] = True <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( delta_remaining ) <EOL> return ret </s>
