docs: def sigfig_str(number, sigfig):
      """
      References:
          http://stackoverflow.com/questions/2663612/nicely-repr-float-in-python
      """
      assert(sigfig > 0)
      try:
          d = decimal.Decimal(number)
      except TypeError:
          d = float_to_decimal(float(number))
      sign, digits, exponent = d.as_tuple()
      if len(digits) < sigfig:
          digits = list(digits)
          digits.extend([0] * (sigfig - len(digits)))
      shift = d.adjusted()
      result = int(''.join(map(str, digits[:sigfig])))
      # Round the result
      if len(digits) > sigfig and digits[sigfig] >= 5:
          result += 1
      result = list(str(result))
      # Rounding can change the length of result
      # If so, adjust shift
      shift += len(result) - sigfig
      # reset len of result to sigfig
      result = result[:sigfig]
      if shift >= sigfig - 1:
          # Tack more zeros on the end
          result += ['0'] * (shift - sigfig + 1)
      elif 0 <= shift:
          # Place the decimal point in between digits
          result.insert(shift + 1, '.')
      else:
          # Tack zeros on the front
          assert(shift < 0)
          result = ['0.'] + ['0'] * (-shift - 1) + result
      if sign:
          result.insert(0, '-')
      return ''.join(result)