code: def cell2code(cell, named_ranges):
      
      if cell.formula:
  
          debug = False
          # if 'OFFSET' in cell.formula or 'INDEX' in cell.formula:
          #     debug = True
          # if debug:
          #     print 'FORMULA', cell.formula
  
          ref = parse_cell_address(cell.address()) if not cell.is_named_range else None
          sheet = cell.sheet
  
          e = shunting_yard(cell.formula, named_ranges, ref=ref, tokenize_range = False)
  
          ast,root = build_ast(e, debug = debug)
          code = root.emit(ast, context=sheet)
  
          # print 'CODE', code, ref
  
      else:
          ast = None
          if isinstance(cell.value, unicode):
              code = u'u"' + cell.value.replace(u'"', u'\\"') + u'"'
          elif isinstance(cell.value, str):
              raise RuntimeError("Got unexpected non-unicode str")
          else:
              code = str(cell.value)
      return code,ast
docs: Generate python code for the given cell