def prepare_env(app, env, docname):
if not hasattr(env, '<STR_LIT>'):<EOL><INDENT>env.needs_all_needs = {}<EOL><DEDENT>if not hasattr(env, '<STR_LIT>'):<EOL><INDENT>env.needs_functions = {}<EOL>needs_functions = app.needs_functions<EOL>if needs_functions is None:<EOL><INDENT>needs_functions = []<EOL><DEDENT>if not isinstance(needs_functions, list):<EOL><INDENT>raise SphinxError('<STR_LIT>')<EOL><DEDENT>for need_common_func in needs_common_functions:<EOL><INDENT>register_func(env, need_common_func)<EOL><DEDENT>for needs_func in needs_functions:<EOL><INDENT>register_func(env, needs_func)<EOL><DEDENT><DEDENT>app.config.needs_hide_options += ['<STR_LIT>']<EOL>app.config.needs_extra_options['<STR_LIT>'] = directives.unchanged<EOL>if not hasattr(env, '<STR_LIT>'):<EOL><INDENT>env.needs_workflow = {<EOL>'<STR_LIT>': False,<EOL>'<STR_LIT>': False<EOL>}<EOL><DEDENT>
Prepares the sphinx environment to store sphinx-needs internal data.