def ip_bracket(addr):
 if (addr and (':' in addr) and (not addr.startswith('['))):
  return '[{0}]'.format(addr)
 return addr

def ip_bracket ( addr ) : if ( addr and ( ':' in addr ) and ( not addr . startswith ( '[' ) ) ) : return '[{0}]' . format ( addr ) return addr
convert ip address representation to zmq format .