def parse_nds_env(env='<STR_LIT>'):
hosts = []<EOL>for host in os.getenv(env).split('<STR_LIT:U+002C>'):<EOL><INDENT>try:<EOL><INDENT>host, port = host.rsplit('<STR_LIT::>', <NUM_LIT:1>)<EOL><DEDENT>except ValueError:<EOL><INDENT>port = None<EOL><DEDENT>else:<EOL><INDENT>port = int(port)<EOL><DEDENT>if (host, port) not in hosts:<EOL><INDENT>hosts.append((host, port))<EOL><DEDENT><DEDENT>return hosts<EOL>
Parse the NDSSERVER environment variable into a list of hosts

    Parameters
    ----------
    env : `str`, optional
        environment variable name to use for server order,
        default ``'NDSSERVER'``. The contents of this variable should
        be a comma-separated list of `host:port` strings, e.g.
        ``'nds1.server.com:80,nds2.server.com:80'``

    Returns
    -------
    hostiter : `list` of `tuple`
        a list of (unique) ``(str, int)`` tuples for each host:port
        pair