def snake_to_pascal(name, singularize=False):
  """Converts snake_case to PascalCase. If singularize is True, an attempt is made at singularizing
  each part of the resulting name.
  """
  parts = name.split("_")
  if singularize:
    return "".join(p.upper() if p in _ALL_CAPS else to_singular(p.title()) for p in parts)
  else:
    return "".join(p.upper() if p in _ALL_CAPS else p.title() for p in parts)
Converts snake_case to PascalCase. If singularize is True, an attempt is made at singularizing
  each part of the resulting name.