def _HandleWildcardCases(first_handler, second_handler):
 merged_handlers = set()
 if ((len(first_handler.pattern) <= 1) or (len(second_handler.pattern) <= 1)):
  return merged_handlers
 if ((first_handler.pattern[(-1)], second_handler.pattern[0]) != ('*', '*')):
  return merged_handlers
 first_no_star = first_handler.pattern[:(-1)]
 merged_handlers.add(SimpleHandler((first_no_star + second_handler.pattern)))
 if second_handler.MatchesString(first_no_star):
  merged_handlers.add(SimpleHandler(first_no_star))
 return merged_handlers

def _HandleWildcardCases ( first_handler , second_handler ) : merged_handlers = set ( ) if ( ( len ( first_handler . pattern ) <= 1 ) or ( len ( second_handler . pattern ) <= 1 ) ) : return merged_handlers if ( ( first_handler . pattern [ ( - 1 ) ] , second_handler . pattern [ 0 ] ) != ( '*' , '*' ) ) : return merged_handlers first_no_star = first_handler . pattern [ : ( - 1 ) ] merged_handlers . add ( SimpleHandler ( ( first_no_star + second_handler . pattern ) ) ) if second_handler . MatchesString ( first_no_star ) : merged_handlers . add ( SimpleHandler ( first_no_star ) ) return merged_handlers
handle cases with trailing and leading wildcards .