code: def _namematcher(regex):
      
  
      matcher = re_compile(regex)
  
      def match(target):
          target_name = getattr(target, '__name__', '')
          result = matcher.match(target_name)
          return result
  
      return match
docs: Checks if a target name matches with an input regular expression.