code: def apply_features(body, features):
      '''Applies features to message body lines.
  
      Returns list of lists. Each of the lists corresponds to the body line
      and is constituted by the numbers of features occurrences (0 or 1).
      E.g. if element j of list i equals 1 this means that
      feature j occurred in line i (counting from the last line of the body).
      '''
      # collect all non empty lines
      lines = [line for line in body.splitlines() if line.strip()]
  
      # take the last SIGNATURE_MAX_LINES
      last_lines = lines[-SIGNATURE_MAX_LINES:]
  
      # apply features, fallback to zeros
      return ([[f(line) for f in features] for line in last_lines] or
              [[0 for f in features]]f apply_features(body, features):
      '''Applies features to message body lines.
  
      Returns list of lists. Each of the lists corresponds to the body line
      and is constituted by the numbers of features occurrences (0 or 1).
      E.g. if element j of list i equals 1 this means that
      feature j occurred in line i (counting from the last line of the body).
      '''
      # collect all non empty lines
      lines = [line for line in body.splitlines() if line.strip()]
  
      # take the last SIGNATURE_MAX_LINES
      last_lines = lines[-SIGNATURE_MAX_LINES:]
  
      # apply features, fallback to zeros
      return ([[f(line) for f in features] for line in last_lines] or
              [[0 for f in features]])
docs: Applies features to message body lines.
  
      Returns list of lists. Each of the lists corresponds to the body line
      and is constituted by the numbers of features occurrences (0 or 1).
      E.g. if element j of list i equals 1 this means that
      feature j occurred in line i (counting from the last line of the body).