def GetSourceFile(file, sourcepath):
  """Return a relative file if it is embedded in a path."""
  for root in sourcepath:
    if file.find(root) == 0:
      prefix_length = len(root)
      if not root.endswith('/'):
        prefix_length += 1
      relative_file = file[prefix_length:]
      return relative_file
  return None