def _GetFailedRevisionFromResultsDict(results_dict):
  """Finds the failed revision from the given dict of revisions.

  Args:
    results_dict: (dict) A dict that maps revisions to their results. For
    example:

    {
        'rev1': 'passed',
        'rev2': 'passed',
        'rev3': 'failed',
    }

    Note results_dict is expected only to have one failed revision which
    will be the one to be returned.

  Returns:
    The revision corresponding to a failed result, if any.
  """
  for revision, result in results_dict.iteritems():
    if result.lower() == 'failed':
      return revision
  return None