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

    numpb = PhoneNumberPB()
    if numobj.country_code is not None:
        numpb.country_code = numobj.country_code
    if numobj.national_number is not None:
        numpb.national_number = numobj.national_number
    if numobj.extension is not None:
        numpb.extension = numobj.extension
    if numobj.italian_leading_zero is not None:
        numpb.italian_leading_zero = numobj.italian_leading_zero
    if numobj.number_of_leading_zeros is not None:
        numpb.number_of_leading_zeros = numobj.number_of_leading_zeros
    if numobj.raw_input is not None:
        numpb.raw_input = numobj.raw_input
    numpb.country_code_source = numobj.country_code_source
    if numobj.preferred_domestic_carrier_code is not None:
        numpb.preferred_domestic_carrier_code = numobj.preferred_domestic_carrier_code
    return numpb