def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
                 basic_auth=None):
    headers = {}
    if accept_encoding:
        if isinstance(accept_encoding, str):
            pass
        elif isinstance(accept_encoding, list):
            accept_encoding = ','.join(accept_encoding)
        else:
            accept_encoding = 'gzip,deflate'
        headers['accept-encoding'] = accept_encoding

    if user_agent:
        headers['user-agent'] = user_agent

    if keep_alive:
        headers['connection'] = 'keep-alive'

    if basic_auth:
        headers['authorization'] = 'Basic ' + \
            b64encode(six.b(basic_auth)).decode('utf-8')

    return headers
Parses dest_str, which is (roughly) of the form
dataset/ETHPy150Open lmorchard/badg.us/vendor-local/lib/python/requests/packages/urllib3/connectionpool.py/make_headers--crossover with--dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/dxpy/scripts/dx_build_app.py/parse_destination