def METHOD_NAME(self, topic, key, message=None):
    # Check if the user enabled topics are valid
    # NOTE: This is done in the first PROFILER.profile() call and
    # not __init__ to ensure we handle the exception. This also means
    # we cannot test for the exception due to the early instantiation and
    # how the environment is set in the test invocation.
    if not self._valid_topics:
        self._check_valid_topics()
    if not self._is_profile_enabled(topic):
        yield
        return
    if self._active_profilers:
        # we are in a nested profiler, stop the parent
        self._active_profilers[-1].stop()
    key = "{}-{}".format(topic, key)
    assert key not in self.active_topics
    self.active_topics.add(key)
    profiler = _Profile(key, message)
    self._active_profilers.append(profiler)
    with profiler:
        yield
    self.active_topics.remove(key)
    # Remove the last profiler from the list
    self._active_profilers.pop()
    if self._active_profilers:
        # We were in a previous profiler, add the previous results to it
        # and reenable it.
        parent_profiler = self._active_profilers[-1]
        parent_profiler.merge(profiler)
        parent_profiler.start()