def serverparse(server):
    user = password = host = port = None
    server = server.split("@", 1)
    if len(server) == 2:
        userinfo, hostport = server
        userinfo = userinfo.split(":",1)
        if len(userinfo) == 2:
            user, password = userinfo
        else:
            user = userinfo[0]
        server = server[1]
    else:
        server = server[0]
    server = server.split(":", 1)
    if len(server) == 2:
        host, port = server
    else:
        host = server[0]
    return user, password, host, port
serverparse(serverpart)
dataset/ETHPy150Open kdart/pycopia/aid/pycopia/urlparse.py/serverparse