<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def PBToPy(numpb):
 """Convert phonenumber_pb2.PhoneNumber to phonenumber.PhoneNumber"""

    return PhoneNumber(country_code=numpb.country_code if numpb.HasField("country_code") else None,
                       national_number=numpb.national_number if numpb.HasField("national_number") else None,
                       extension=numpb.extension if numpb.HasField("extension") else None,
                       italian_leading_zero=numpb.italian_leading_zero if numpb.HasField("italian_leading_zero") else None,
                       number_of_leading_zeros=numpb.number_of_leading_zeros if numpb.HasField("number_of_leading_zeros") else None,
                       raw_input=numpb.raw_input if numpb.HasField("raw_input") else None,
                       country_code_source=numpb.country_code_source if numpb.HasField("country_code_source") else CountryCodeSource.UNSPECIFIED,
                       preferred_domestic_carrier_code=numpb.preferred_domestic_carrier_code if numpb.HasField("preferred_domestic_carrier_code") else None)