<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _create_regexp_filter(regex):
 """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. """

  # 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