def set_maintenance(start=None, end=None):
 if (not database):
  return None
 start = (parse(start) if start else timezone.now())
 end = (parse(end) if end else (start + timedelta(1)))
 if (not start.tzinfo):
  start = start.replace(tzinfo=pytz.UTC)
 if (not end.tzinfo):
  end = end.replace(tzinfo=pytz.UTC)
 if (start > end):
  start = (end - timedelta(1))
 unset_maintenance()
 database.maintenance.insert({'maintenance': True, 'start': start.isoformat(), 'end': end.isoformat()})

def set_maintenance ( start = None , end = None ) : if ( not database ) : return None start = ( parse ( start ) if start else timezone . now ( ) ) end = ( parse ( end ) if end else ( start + timedelta ( 1 ) ) ) if ( not start . tzinfo ) : start = start . replace ( tzinfo = pytz . UTC ) if ( not end . tzinfo ) : end = end . replace ( tzinfo = pytz . UTC ) if ( start > end ) : start = ( end - timedelta ( 1 ) ) unset_maintenance ( ) database . maintenance . insert ( { 'maintenance' : True , 'start' : start . isoformat ( ) , 'end' : end . isoformat ( ) } )
put a member into recovering state if value is true .