def level_matches(self, level, consumer_level):
if isinstance(level, slice):<EOL><INDENT>start, stop = level.start, level.stop<EOL>if start is not None and start > consumer_level:<EOL><INDENT>return False<EOL><DEDENT>if stop is not None and stop <= consumer_level:<EOL><INDENT>return False<EOL><DEDENT>return True<EOL><DEDENT>else:<EOL><INDENT>return level >= consumer_level<EOL><DEDENT>
>>> l = Logger([])
>>> l.level_matches(3, 4)
False
>>> l.level_matches(3, 2)
True
>>> l.level_matches(slice(None, 3), 3)
False
>>> l.level_matches(slice(None, 3), 2)
True
>>> l.level_matches(slice(1, 3), 1)
True
>>> l.level_matches(slice(2, 3), 1)
False