code: def _create_regexp_filter(regex):
    
    # Warning: Note that python's regex library allows inputs that take
    # exponential time. Time-limiting it is difficult. When we move to
    # a true multi-tenant tensorboard server, the regexp implementation here
    # would need to be replaced by something more secure.
    compiled_regex = re.compile(regex)
    def filter_fn(value):
      if not isinstance(value, six.string_types):
        raise error.HParamsError(
            'Cannot use a regexp filter for a value of type %s. Value: %s' %
            (type(value), value))
      return re.search(compiled_regex, value) is not None
  
    return filter_fn
docs: Returns a boolean function that filters strings based on a regular exp.
  
    Args:
      regex: A string describing the regexp to use.
    Returns:
      A function taking a string and returns True if any of its substrings
      matches regex.