code: def number_to_dp(number: Optional[float],
                   dp: int,
                   default: Optional[str] = "",
                   en_dash_for_minus: bool = True) -> str:
      
      if number is None:
          return default
      if number == float("inf"):
          return u"∞"
      if number == float("-inf"):
          s = u"-∞"
      else:
          s = u"{:.{precision}f}".format(number, precision=dp)
      if en_dash_for_minus:
          s = s.replace("-", u"–")  # hyphen becomes en dash for minus sign
      return s
docs: Format number to ``dp`` decimal places, optionally using a UTF-8 en dash
      for minus signs.