code: def filter_batched_data(data, mapping):
      
      for k, v in list(mapping.items()):
          if isinstance(v, dict) and 'field' in v:
              if 'transform' in v:
                  continue
              v = v['field']
          elif not isinstance(v, basestring):
              continue
          values = data[v]
          try:
              if len(unique_array(values)) == 1:
                  mapping[k] = values[0]
                  del data[v]
          except:
              pass
docs: Iterates over the data and mapping for a ColumnDataSource and
      replaces columns with repeating values with a scalar. This is
      purely and optimization for scalar types.