def parse(uri, user=None, port=22):

    uri = uri.strip()

    if not user:
        user = getpass.getuser()

    # get user
    if '@' in uri:
        user = uri.split("@")[0]

    # get port
    if ':' in uri:
        port = uri.split(":")[-1]

    try:
        port = int(port)
    except ValueError:
        raise ValueError("port must be numeric.")

    # get host
    uri = re.sub(":.*", "", uri)
    uri = re.sub(".*@", "", uri)
    host = uri

    return (
        user,
        host,
        port,
    )
parses ssh connection uri-like sentences.
dataset/ETHPy150Open emre/storm/storm/parsers/ssh_uri_parser.py/parse