code: def get_scalar(mesh, name, preference='cell', info=False, err=False):
      
      parr = point_scalar(mesh, name)
      carr = cell_scalar(mesh, name)
      if isinstance(preference, str):
          if preference in ['cell', 'c', 'cells']:
              preference = CELL_DATA_FIELD
          elif preference in ['point', 'p', 'points']:
              preference = POINT_DATA_FIELD
          else:
              raise RuntimeError('Data field ({}) not supported.'.format(preference))
      if all([parr is not None, carr is not None]):
          if preference == CELL_DATA_FIELD:
              if info:
                  return carr, CELL_DATA_FIELD
              else:
                  return carr
          elif preference == POINT_DATA_FIELD:
              if info:
                  return parr, POINT_DATA_FIELD
              else:
                  return parr
          else:
              raise RuntimeError('Data field ({}) not supported.'.format(preference))
      arr = None
      field = None
      if parr is not None:
          arr = parr
          field = 0
      elif carr is not None:
          arr = carr
          field = 1
      elif err:
          raise KeyError('Data scalar ({}) not present in this dataset.'.format(name))
      if info:
          return arr, field
      return arr
docs: Searches both point and cell data for an array
  
      Parameters
      ----------
      name : str
          The name of the array to get the range.
  
      preference : str, optional
          When scalars is specified, this is the perfered scalar type to
          search for in the dataset.  Must be either ``'point'`` or ``'cell'``
  
      info : bool
          Return info about the scalar rather than the array itself.
  
      err : bool
          Boolean to control whether to throw an error if array is not present.