<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _prepare_resources(self, variables, overrides=None):
 """Create and optionally open all shared resources."""


        if overrides is None:
            overrides = {}

        res_map = {}
        own_map = {}

        for decl in self.resources.values():
            resource = overrides.get(decl.name)

            if resource is None:
                args = _complete_parameters(decl.args, variables)
                resource = decl.type(args)
                own_map[decl.name] = resource

            if decl.autocreate:
                resource.open()

            res_map[decl.name] = resource

        return res_map, own_map