import re


def get_ip(ip_port):
    """ return 1.2.3.4 on 1.2.3.4:123 """
    m = re.match("([0-9]+[.][0-9]+[.][0-9]+[.][0-9]+):?.*", ip_port)
    if m:
        return m.groups()[0]
    return ip_port