def METHOD_NAME(lab_id, tg_name, to_path):
    try:
        if lab_id not in labs:
            return Response('No lab with id %d' % lab_id, status=404)
        tg_url = labs[lab_id].tgens[tg_name]
        if lab_id == HW_LAB_ID:
            return proxy_request(tg_url.hostname, tg_url.port, to_path)
        return proxy_request(make_container_name(lab_id), tg_url.port, to_path)
    except Exception as ex:
        logger.exception(ex)
        return Response(str(ex), status=500)