<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def show_stack_depth(self, record, frame):
 """ Compute the maximum stack depth to show requested by any hooks, returning -1 if there are none matching, or if we've already emitted one for the line of code referred to. """

        logger = self

        depths = [-1]
        msg = record.getMessage()

        # For each logger in the hierarchy
        while logger:
            to_match = getattr(logger, "show_stack_regexes", ())
            for regex, depth, once, min_level in to_match:
                if record.levelno < min_level:
                    continue
                if not regex.match(record.msg):
                    continue
                # Only for a given regex, line number and logger
                unique = regex, self.frame_unique(frame), record.name
                if once:
                    if unique in logger.shown_stack_frames:
                        # We've shown this one already.
                        continue
                    # Prevent this stack frame from being shown again
                    logger.shown_stack_frames.add(unique)
                depths.append(depth)
            logger = logger.parent
        return max(depths)