def GenerateSuspectedRanges(suspected_revisions, revision_range):
  """Generates a list of revision tuples.

  Args:
    revision_range (list): The list of revisions of a suspected flake build.
        The revisions are expected to be in chronological order as a
        DataPoint's blame_list.
    suspected_revisions (list): A list of suspected revisions according to
        git blame.

  Returns:
    A list of (previous, suspected_revision) tuples. For example, if r1-r10 are
        in the revision range and r1 and r5 are suspected, then returns
        [(None, r1), (r4, r5)]. These values will be passed to the try job
        pipeline to run the previous and suspected revision(s) to confirm the
        suspected revision(s) of being the culprit.
  """
  ranges = []
  previous = None

  for revision in revision_range:
    if revision in suspected_revisions:
      ranges.append((previous, revision))
    previous = revision

  return ranges