code: def b58decode(s, errors='strict'):
      "Decode a base58-encoding string, returning bytes."
      if not s:
          return (b'', 0)
  
      # Convert the string to an integer
      n = 0
      for c in s:
          n *= 58
          if c not in b58digits:
              raise InvalidBase58Error(u"character %r is not a valid base58 "
                  u"character" % c)
          digit = b58digits.index(c)
          n += digit
  
      # Convert the integer to bytes
      res = BigInteger(n).serialize((n.bit_length()+7)//8 or 1)
  
      # Add padding back.
      pad = 0
      for c in s[:-1]:
          if c == b58digits[0]: pad += 1
          else: break
      return (b'\x00' * pad + res, len(s)f b58decode(s, errors='strict'):
      "Decode a base58-encoding string, returning bytes."
      if not s:
          return (b'', 0)
  
      # Convert the string to an integer
      n = 0
      for c in s:
          n *= 58
          if c not in b58digits:
              raise InvalidBase58Error(u"character %r is not a valid base58 "
                  u"character" % c)
          digit = b58digits.index(c)
          n += digit
  
      # Convert the integer to bytes
      res = BigInteger(n).serialize((n.bit_length()+7)//8 or 1)
  
      # Add padding back.
      pad = 0
      for c in s[:-1]:
          if c == b58digits[0]: pad += 1
          else: break
      return (b'\x00' * pad + res, len(s))
docs: Decode a base58-encoding string, returning bytes.