code: def closest(self, coords=[], **kwargs):
          
          if self.ndims > 1:
              raise NotImplementedError("Closest method currently only "
                                        "implemented for 1D Elements")
  
          if kwargs:
              if len(kwargs) > 1:
                  raise NotImplementedError("Closest method currently only "
                                            "supports 1D indexes")
              samples = list(kwargs.values())[0]
              coords = samples if isinstance(samples, list) else [samples]
  
          xs = self.dimension_values(0)
          if xs.dtype.kind in 'SO':
              raise NotImplementedError("Closest only supported for numeric types")
          idxs = [np.argmin(np.abs(xs-coord)) for coord in coords]
          return [xs[idx] for idx in idxs]
docs: Snaps coordinate(s) to closest coordinate in Dataset
  
          Args:
              coords: List of coordinates expressed as tuples
              **kwargs: Coordinates defined as keyword pairs
  
          Returns:
              List of tuples of the snapped coordinates
  
          Raises:
              NotImplementedError: Raised if snapping is not supported