code: def _format_phone_number(self, value, attr):
          
          strict_validation = self.get_field_value(
              'strict_phone_validation',
              default=False
          )
          strict_region = self.get_field_value(
              'strict_phone_region',
              default=strict_validation
          )
          region = self.get_field_value('region', 'US')
          phone_number_format = self.get_field_value(
              'phone_number_format',
              default=phonenumbers.PhoneNumberFormat.INTERNATIONAL
          )
  
          # Remove excess special chars, except for the plus sign
          stripped_value = re.sub(r'[^\w+]', '', value)
  
          try:
              if not stripped_value.startswith('+') and not strict_region:
                  phone = phonenumbers.parse(stripped_value, region)
              else:
                  phone = phonenumbers.parse(stripped_value)
  
              if (not phonenumbers.is_possible_number(phone) or
                      not phonenumbers.is_valid_number(phone) and
                      strict_validation):
                  raise ValidationError(
                      "The value for {} ({}) is not a valid phone "
                      "number.".format(attr, value)
                  )
  
              return phonenumbers.format_number(phone, phone_number_format)
  
          except phonenumbers.phonenumberutil.NumberParseException as exc:
              if strict_validation or strict_region:
                  raise ValidationError(exc)
docs: Format and validate a phone number.