import glob


def _GetCasedFilename(filename):
  """Returns the full case-sensitive filename for the given |filename|. If the
  path does not exist, returns the original |filename| as is.
  """
  pattern = '%s[%s]' % (filename[:-1], filename[-1])
  filenames = glob.glob(pattern)
  if not filenames:
    return filename
  return filenames[0]