def _sanitize_tag(match):
 tag = match.group(0)
 if (ALLOWED_BASIC_TAG_PATTERN.match(tag) or ALLOWED_A_PATTERN.match(tag) or ALLOWED_IMG_PATTERN.match(tag)):
  return tag
 else:
  return ''

def _sanitize_tag ( match ) : tag = match . group ( 0 ) if ( ALLOWED_BASIC_TAG_PATTERN . match ( tag ) or ALLOWED_A_PATTERN . match ( tag ) or ALLOWED_IMG_PATTERN . match ( tag ) ) : return tag else : return ''
return the tag if it is allowed or the empty string otherwise .