def METHOD_NAME(line):
  global in_spam
  global next_line_is_spam
  if not next_line_is_spam:
    in_spam = False
  if not in_spam:
    if start_of_spam in line:
      in_spam = True
      next_line_is_spam = True
  else:
    if end_of_spam in line:
      # current line is spam, but the next one isn't (as far as we know at this moment)
      next_line_is_spam = False
  return in_spam