def _maybe_coerce_freq(code):
 assert (code is not None)
 if isinstance(code, offsets.DateOffset):
  code = code.rule_code
 return code.upper()

def _maybe_coerce_freq ( code ) : assert ( code is not None ) if isinstance ( code , offsets . DateOffset ) : code = code . rule_code return code . upper ( )
we might need to coerce a code to a rule_code and uppercase it parameters source : string frequency converting from returns string code .