def _import_and_bind(self, imp):
<EOL>with self.block.alloc_temp() as mod,self.block.alloc_temp('<STR_LIT>') as mod_slice:<EOL><INDENT>self.writer.write_checked_call2(<EOL>mod_slice, '<STR_LIT>', util.go_str(imp.name))<EOL>for binding in imp.bindings:<EOL><INDENT>if binding.bind_type == imputil.Import.MODULE:<EOL><INDENT>self.writer.write('<STR_LIT>'.format(<EOL>mod.name, mod_slice.expr, binding.value))<EOL>self.block.bind_var(self.writer, binding.alias, mod.expr)<EOL><DEDENT>else:<EOL><INDENT>self.writer.write('<STR_LIT>'.format(<EOL>mod.name, mod_slice.expr, imp.name.count('<STR_LIT:.>')))<EOL>with self.block.alloc_temp() as member:<EOL><INDENT>self.writer.write_checked_call2(<EOL>member, '<STR_LIT>',<EOL>mod.expr, self.block.root.intern(binding.value))<EOL>self.block.bind_var(self.writer, binding.alias, member.expr)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Generates code that imports a module and binds it to a variable.

        Args:
          imp: Import object representing an import of the form "import x.y.z" or
              "from x.y import z". Expects only a single binding.