code: def distance_to_contact(D, alpha=1):
      
  
      if callable(alpha):
          distance_function = alpha
      else:
          try:
              a = np.float64(alpha)
  
              def distance_function(x):
                  return 1 / (x ** (1 / a))
          except TypeError:
              print("Alpha parameter must be callable or an array-like")
              raise
          except ZeroDivisionError:
              raise ValueError("Alpha parameter must be non-zero")
  
      m = np.max(distance_function(D[D != 0]))
      M = np.zeros(D.shape)
      M[D != 0] = distance_function(D[D != 0])
      M[D == 0] = m
      return M
docs: Compute contact matrix from input distance matrix. Distance values of
      zeroes are given the largest contact count otherwise inferred non-zero
      distance values.