

def path_for_host(host, environ=None):
    'Get the filesystem path that the given host is being faked at'
    if (environ is None):
        environ = os.environ
    for kv_pair in environ['MOCK_SSH_ROOTS'].split(':'):
        (this_host, this_path) = kv_pair.split('=')
        if (this_host == host):
            return os.path.abspath(this_path)
    raise KeyError(('Host %s is not specified in $MOCK_SSH_ROOTS (%s)' % (host, environ['MOCK_SSH_ROOTS'])))

dataset/ETHPy150Open Yelp/mrjob/tests/mockssh.py path_for_host/original