docs: def biasFromLocations(locs, preferOrigin=True):
      """
          Find the vector that translates the whole system to the origin. 
      """
      dims = {}
      locs.sort()
      for l in locs:
          for d in l.keys():
              if not d in dims:
                  dims[d] = []
              v = l[d]
              if type(v)==tuple:
                  dims[d].append(v[0])
                  dims[d].append(v[1])
              else:
                  dims[d].append(v)
      candidate = Location()
      for k in dims.keys():
          dims[k].sort()
          v = mostCommon(dims[k])
          if dims[k].count(v) > 1:
              # add the dimension with two or more hits
              candidate[k] = mostCommon(dims[k])
      matches = []
      # 1. do we have an exact match?
      for l in locs:
          if candidate == l:
              return l
      # 2. find a location that matches candidate (but has more dimensions)
      for l in locs:
          ok = True
          for k, v in candidate.items():
              if l.get(k)!=v:
                  ok = False
                  break
          if ok:
              if not l in matches:
                  matches.append(l)
      matches.sort()
      if len(matches)>0:
          if preferOrigin:
              for c in matches:
                  if c.isOrigin():
                      return c
          return matches[0]
      # 3. no matches. Find the best from the available locations
      results = {}
      for bias in locs:
          rel = []
          for l in locs:
              rel.append((l - bias).isOnAxis())
          c = rel.count(False)
          if not c in results:
              results[c] = []
          results[c].append(bias)
      if results:
          candidates = results[min(results.keys())]
          if preferOrigin:
              for c in candidates:
                  if c.isOrigin():
                      return c
          candidates.sort()
          return candidates[0]
      return Location()