Convert an object representing a contact information to an instance
        `Contact`.


        @param obj: an object containg the following attributes:

            * `name`: an item of the enumeration `ContactName` representing the
              type of this contact information.

            * `value`: value of this contact information representing by a string,
              such as ``+84.01272170781``, the formatted value for a telephone
              number property.

            * `is_primary`: indicate whether this contact property is the first to
              be used to contact the entity that this contact information
              corresponds to.  There is only one primary contact property for a
              given property name (e.g., `EMAIL`, `PHONE`, `WEBSITE`).

            * `is_verified`: indicate whether this contact information has been
              verified, whether it has been grabbed from a trusted Social
              Networking Service (SNS), or whether through a challenge/response
              process.


        @raise ValueError: if the value of this contact information is null.

def from_object(obj):
        """
        Convert an object representing a contact information to an instance
        `Contact`.


        @param obj: an object containg the following attributes:

            * `name`: an item of the enumeration `ContactName` representing the
              type of this contact information.

            * `value`: value of this contact information representing by a string,
              such as ``+84.01272170781``, the formatted value for a telephone
              number property.

            * `is_primary`: indicate whether this contact property is the first to
              be used to contact the entity that this contact information
              corresponds to.  There is only one primary contact property for a
              given property name (e.g., `EMAIL`, `PHONE`, `WEBSITE`).

            * `is_verified`: indicate whether this contact information has been
              verified, whether it has been grabbed from a trusted Social
              Networking Service (SNS), or whether through a challenge/response
              process.


        @raise ValueError: if the value of this contact information is null.
        """
        return obj if isinstance(obj, Contact) \
            else Contact(cast.string_to_enum(obj.name, Contact.ContactName),
                         obj.value,
                         is_primary=obj.is_primary and cast.string_to_boolean(obj.is_primary, strict=True),
                         is_verified=obj.is_verified and cast.string_to_boolean(obj.is_verified, strict=True))