def _fix_tagging(value, params):
 if (u'tag_type' in params):
  required_tag_type = params[u'tag_type']
  retag = False
  if (required_tag_type != value.tag_type):
   retag = True
  elif ((required_tag_type == u'explicit') and (value.explicit_tag != params[u'tag'])):
   retag = True
  elif ((required_tag_type == u'implicit') and (value.tag != params[u'tag'])):
   retag = True
  if retag:
   return value.retag(params[u'tag_type'], params[u'tag'])
  return value
 if value.tag_type:
  return value.untag()
 return value

def _fix_tagging ( value , params ) : if ( u'tag_type' in params ) : required_tag_type = params [ u'tag_type' ] retag = False if ( required_tag_type != value . tag_type ) : retag = True elif ( ( required_tag_type == u'explicit' ) and ( value . explicit_tag != params [ u'tag' ] ) ) : retag = True elif ( ( required_tag_type == u'implicit' ) and ( value . tag != params [ u'tag' ] ) ) : retag = True if retag : return value . retag ( params [ u'tag_type' ] , params [ u'tag' ] ) return value if value . tag_type : return value . untag ( ) return value
checks if a value is properly tagged based on the spec .