docs: def locations_within(a, b, tolerance):
      """
      Verifies whether two positions are the same. A tolerance value
      determines how close the two positions must be to be considered
      "same".
  
      The two locations must be dictionaries that have the same keys. If
      a key is pesent in one but not in the other, this is an error. The
      values must be integers or anything that can be converted to an
      integer through ``int``. (If somehow you need floating point
      precision, this is not the function for you.)
  
      Do not rely on this function to determine whether two object have
      the same keys. If the function finds the locations to be within
      tolerances, then the two objects have the same keys. Otherwise,
      you cannot infer anything regarding the keys because the function
      will return as soon as it knows that the two locations are **not**
      within tolerance.
  
      :param a: First position.
      :type a: :class:`dict`
      :param b: Second position.
      :type b: :class:`dict`
      :param tolerance: The tolerance within which the two positions
                        must be.
      :return: An empty string if the comparison is successful. Otherwise,
               the string contains a description of the differences.
      :rtype: :class:`str`
      :raises ValueError: When a key is present in one object but not
                          the other.
      """
      ret = ''
      # Clone b so that we can destroy it.
      b = dict(b)
  
      for (key, value) in a.items():
          if key not in b:
              raise ValueError("b does not have the key: " + key)
          if abs(int(value) - int(b[key])) > tolerance:
              ret += 'key {0} differs: {1} {2}'.format(key, int(value),
                                                       int(b[key]))
          del b[key]
  
      if b:
          raise ValueError("keys in b not seen in a: " + ", ".join(b.keys()))
  
      return ret