'Sets the value of the object
:param value:
A unicode string containing an IPv4 address, IPv4 address with CIDR,
an IPv6 address or IPv6 address with CIDR'

def set(self, value):

    if (not isinstance(value, str_cls)):
        raise TypeError(unwrap(u'\n                                                                %s    value    must    be    a    unicode    string,    not    %s\n                                                                ', type_name(self), type_name(value)))
    original_value = value
    has_cidr = (value.find(u'/') != (-1))
    cidr = 0
    if has_cidr:
        parts = value.split(u'/', 1)
        value = parts[0]
        cidr = int(parts[1])
        if (cidr < 0):
            raise ValueError(unwrap(u'\n                                                                                %s    value    contains    a    CIDR    range    less    than    0\n                                                                                ', type_name(self)))
    if (value.find(u':') != (-1)):
        family = socket.AF_INET6
        if (cidr > 128):
            raise ValueError(unwrap(u'\n                                                                                %s    value    contains    a    CIDR    range    bigger    than    128,    the    maximum\n                                                                                value    for    an    IPv6    address\n                                                                                ', type_name(self)))
        cidr_size = 128
    else:
        family = socket.AF_INET
        if (cidr > 32):
            raise ValueError(unwrap(u'\n                                                                                %s    value    contains    a    CIDR    range    bigger    than    32,    the    maximum\n                                                                                value    for    an    IPv4    address\n                                                                                ', type_name(self)))
        cidr_size = 32
    cidr_bytes = ''
    if has_cidr:
        cidr_mask = (u'1' * cidr)
        cidr_mask += (u'0' * (cidr_size - len(cidr_mask)))
        cidr_bytes = int_to_bytes(int(cidr_mask, 2))
        cidr_bytes = (('\x00' * ((cidr_size // 8) - len(cidr_bytes))) + cidr_bytes)
    self._native = original_value
    self.contents = (inet_pton(family, value) + cidr_bytes)
    self._bytes = self.contents
    self._header = None
    if (self._trailer != ''):
        self._trailer = ''
