def _SnakeToCamelString(field_name):
  """Change a snake_case string into a camelCase string.

  Args:
    field_name: str, the string to be transformed.

  Returns:
    str, the transformed string.
  """
  parts = field_name.split('_')
  if not parts:
    return field_name

  # Handle field_name with leading '_'s by collapsing them into the next part.
  # Legit field names will never look like this, but completeness of the
  # function is important.
  leading_blanks = 0
  for p in parts:
    if not p:
      leading_blanks += 1
    else:
      break
  if leading_blanks:
    parts = parts[leading_blanks:]
    if not parts:
      # If they were all blanks, then we over-counted by one because of split
      # behavior.
      return '_'*(leading_blanks-1)
    parts[0] = '_'*leading_blanks + parts[0]

  return ''.join(parts[:1] + [s.capitalize() for s in parts[1:]])