def _explode_shorthand_ip_string(self, ip_str=None):
        if not ip_str:
            ip_str = str(self)
            if isinstance(self, _BaseNet):
                ip_str = str(self.ip)

        if self._is_shorthand_ip(ip_str):
            new_ip = []
            hextet = ip_str.split('::')

            if len(hextet) > 1:
                sep = len(hextet[0].split(':')) + len(hextet[1].split(':'))
                new_ip = hextet[0].split(':')

                for _ in xrange(8 - sep):
                    new_ip.append('0000')
                new_ip += hextet[1].split(':')

            else:
                new_ip = ip_str.split(':')
            # Now need to make sure every hextet is 4 lower case characters.
            # If a hextet is < 4 characters, we've got missing leading 0's.
            ret_ip = []
            for hextet in new_ip:
                # ret_ip.append(('0' * (4 - len(hextet)) + hextet).lower())
                # The line above is to complicated for pyjamas
                _h = '0' * (4 - len(hextet)) + hextet
                ret_ip.append(_h.lower())
            return ':'.join(ret_ip)
        # We've already got a longhand ip_str.
        return ip_str
Expand a shortened IPv6 address.
dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/lib/ipaddr.py/_BaseV6._explode_shorthand_ip_string