code: def _get_var_array(self, k, use_raw=False, layer='X'):
          
          in_raw_obs_names = k in self.raw.obs_names if self.raw is not None else False
  
          if use_raw and self.raw is None:
              raise ValueError('.raw doesn\'t exist')
  
          if k in self.var.keys():
              x = self._var[k]
          elif in_raw_obs_names and use_raw and layer == 'X':
              x = self.raw[k].X
          elif k in self.obs_names and not use_raw and (layer == 'X' or layer in self.layers.keys()):
              x = self[k].X if layer=='X' else self[k].layers[layer]
          elif use_raw and layer != 'X':
              raise ValueError('No layers in .raw')
          elif layer != 'X' and layer not in self.layers.keys():
              raise ValueError('Did not find {} in layers.keys.'
                               .format(layer))
          else:
              raise ValueError('Did not find {} in var.keys or obs_names.'
                               .format(k))
          return x
docs: Get an array from the layer (default layer='X') along the variables dimension by first looking up
          ``var.keys`` and then ``obs.index``.