def PBToPy(numpb):
 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 None), preferred_domestic_carrier_code=(numpb.preferred_domestic_carrier_code if numpb.HasField('preferred_domestic_carrier_code') else None))

def PBToPy ( numpb ) : 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 None ) , preferred_domestic_carrier_code = ( numpb . preferred_domestic_carrier_code if numpb . HasField ( 'preferred_domestic_carrier_code' ) else None ) )
convert phonenumber_pb2 .