human
Complete the below
def create_py3_base_library(libzip_filename, graph):

    ''''Package basic Python modules into .zip file. The .zip file with basic
    modules is necessary to have on PYTHONPATH for initializing libpython3
    in order to run the frozen executable with Python 3.'
    '''
assistant
#Here is the Python code you requested.
    def _write_long(f, x):
        '\n                                Write    a    32-bit    int    to    a    file    in    little-endian    order.\n                                '
        f.write(bytes([(x & 255), ((x >> 8) & 255), ((x >> 16) & 255), ((x >> 24) & 255)]))
    regex_modules = '|'.join([('(^%s$)' % x) for x in PY3_BASE_MODULES])
    regex_submod = '|'.join([('(^%s\\..*$)' % x) for x in PY3_BASE_MODULES])
    regex_str = ((regex_modules + '|') + regex_submod)
    module_filter = re.compile(regex_str)
    try:
        if os.path.exists(libzip_filename):
            os.remove(libzip_filename)
        logger.debug('Adding    python    files    to    base_library.zip')
        with zipfile.ZipFile(libzip_filename, mode='w') as zf:
            zf.debug = 3
            for mod in graph.flatten():
                if (type(mod) in (modulegraph.SourceModule, modulegraph.Package)):
                    if module_filter.match(mod.identifier):
                        st = os.stat(mod.filename)
                        timestamp = int(st.st_mtime)
                        size = (st.st_size & 4294967295)
                        if (type(mod) is modulegraph.Package):
                            new_name = (((mod.identifier.replace('.', os.sep) + os.sep) + '__init__') + '.pyc')
                        else:
                            new_name = (mod.identifier.replace('.', os.sep) + '.pyc')
                        with io.BytesIO() as fc:
                            fc.write(BYTECODE_MAGIC)
                            _write_long(fc, timestamp)
                            _write_long(fc, size)
                            marshal.dump(mod.code, fc)
                            zf.writestr(new_name, fc.getvalue())
    except Exception as e:
        logger.error('base_library.zip    could    not    be    created!')
        raise