<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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)