def _store_func_and_modules(func_key, func_str, module_data):
    func_path = '/'.join([LITHOPS_TEMP_DIR, func_key])
    os.makedirs(os.path.dirname(func_path), exist_ok=True)
    with open(func_path, 'wb') as f:
        f.write(func_str)
    if module_data:
        logger.debug('Writing Function dependencies to local disk')
        modules_path = '/'.join([os.path.dirname(func_path), 'modules'])
        for (m_filename, m_data) in module_data.items():
            m_path = os.path.dirname(m_filename)
            if ((len(m_path) > 0) and (m_path[0] == '/')):
                m_path = m_path[1:]
            to_make = os.path.join(modules_path, m_path)
            try:
                os.makedirs(to_make)
            except OSError as e:
                if (e.errno == 17):
                    pass
                else:
                    raise e
            full_filename = os.path.join(to_make, os.path.basename(m_filename))
            with open(full_filename, 'wb') as fid:
                fid.write(b64str_to_bytes(m_data))
    logger.debug('Finished storing function and modules')
def _store_func_and_modules(func_key, func_str, module_data):
    func_path = '/'.join([LITHOPS_TEMP_DIR, func_key])
    os.makedirs(os.path.dirname(func_path), exist_ok=True)
    with open(func_path, 'wb') as f:
        f.write(func_str)
    if module_data:
        logger.debug('Writing Function dependencies to local disk')
        modules_path = '/'.join([os.path.dirname(func_path), 'modules'])
        for (m_filename, m_data) in module_data.items():
            m_path = os.path.dirname(m_filename)
            if ((len(m_path) > 0) and (m_path[0] == '/')):
                m_path = m_path[1:]
            to_make = os.path.join(modules_path, m_path)
            try:
                os.makedirs(to_make)
            except OSError as e:
                if (e.errno == 17):
                    pass
                else:
                    raise e
            full_filename = os.path.join(to_make, os.path.basename(m_filename))
            with open(full_filename, 'wb') as fid:
                fid.write(b64str_to_bytes(m_data))
    logger.debug('Finished storing function and modules')