docs: def params_to_blr(self, trans_handle, params):
          "Convert parameter array to BLR and values format."
          ln = len(params) * 2
          blr = bs([5, 2, 4, 0, ln & 255, ln >> 8])
          if self.accept_version < PROTOCOL_VERSION13:
              values = bs([])
          else:
              # start with null indicator bitmap
              null_indicator = 0
              for i, p in enumerate(params):
                  if p is None:
                      null_indicator |= (1 << i)
              n = len(params) // 8
              if len(params) % 8 != 0:
                  n += 1
              if n % 4:   # padding
                  n += 4 - n % 4
              null_indicator_bytes = []
              for i in range(n):
                  null_indicator_bytes.append(null_indicator & 255)
                  null_indicator >>= 8
              values = bs(null_indicator_bytes)
          for p in params:
              if (
                  (PYTHON_MAJOR_VER == 2 and type(p) == unicode) or
                  (PYTHON_MAJOR_VER == 3 and type(p) == str)
              ):
                  p = self.str_to_bytes(p)
              t = type(p)
              if p is None:
                  v = bs([])
                  blr += bs([14, 0, 0])
              elif (
                  (PYTHON_MAJOR_VER == 2 and t == str) or
                  (PYTHON_MAJOR_VER == 3 and t == bytes)
              ):
                  if len(p) > MAX_CHAR_LENGTH:
                      v = self._create_blob(trans_handle, p)
                      blr += bs([9, 0])
                  else:
                      v = p
                      nbytes = len(v)
                      pad_length = ((4-nbytes) & 3)
                      v += bs([0]) * pad_length
                      blr += bs([14, nbytes & 255, nbytes >> 8])
              elif t == int:
                  v = bint_to_bytes(p, 4)
                  blr += bs([8, 0])    # blr_long
              elif t == float and p == float("inf"):
                  v = b'\x7f\x80\x00\x00'
                  blr += bs([10])
              elif t == decimal.Decimal or t == float:
                  if t == float:
                      p = decimal.Decimal(str(p))
                  (sign, digits, exponent) = p.as_tuple()
                  v = 0
                  ln = len(digits)
                  for i in range(ln):
                      v += digits[i] * (10 ** (ln - i - 1))
                  if sign:
                      v *= -1
                  v = bint_to_bytes(v, 8)
                  if exponent < 0:
                      exponent += 256
                  blr += bs([16, exponent])
              elif t == datetime.date:
                  v = convert_date(p)
                  blr += bs([12])
              elif t == datetime.time:
                  if p.tzinfo:
                      v = convert_time_tz(p)
                      blr += bs([28])
                  else:
                      v = convert_time(p)
                      blr += bs([13])
              elif t == datetime.datetime:
                  if p.tzinfo:
                      v = convert_timestamp_tz(p)
                      blr += bs([29])
                  else:
                      v = convert_timestamp(p)
                      blr += bs([35])
              elif t == bool:
                  v = bs([1, 0, 0, 0]) if p else bs([0, 0, 0, 0])
                  blr += bs([23])
              else:   # fallback, convert to string
                  p = p.__repr__()
                  if PYTHON_MAJOR_VER == 3 or (PYTHON_MAJOR_VER == 2 and type(p) == unicode):
                      p = self.str_to_bytes(p)
                  v = p
                  nbytes = len(v)
                  pad_length = ((4-nbytes) & 3)
                  v += bs([0]) * pad_length
                  blr += bs([14, nbytes & 255, nbytes >> 8])
              blr += bs([7, 0])
              values += v
              if self.accept_version < PROTOCOL_VERSION13:
                  values += bs([0]) * 4 if not p is None else bs([0xff, 0xff, 0xff, 0xff])
          blr += bs([255, 76])    # [blr_end, blr_eoc]
          return blr, values