- for section in ip.split("::")]
- return expand_start + (32-len(expand_start)-len(expand_end))*"0" + expand_end
+ for section in ip.split("::", 1)]
+ if len(expand_sections) == 1:
+ return expand_sections[0]
+ return expand_sections[0] + "".join((32-sum([len(x) for x in expand_sections]))*"0") + expand_sections[1]