new_contents: from hashlib import sha256
  import string
  import random
  
  from pycoin import wallet
  
  
  def _random_wallet_key(size=1024, chars=string.printable):
      """Generate a random key for a bitcoin wallet.
  
      TODO: Verify that this is a good idea.
      """
      return sha256(''.join(random.choice(chars) for x in xrange(size))).digest()
  
  
  def create_address(master_pub_key, address_id):
      """Create a new address from a public key.
  
      Args:
          master_pub_key: A master public key for a wallet generated by
              wallet.Wallet.public_copy()
          address_id: The ID of the user you want to generate an address for.
              Address IDs should be positive integers that can be associated
              with the account that you're creating an address for.
  
      Creating a new address is useful for merchants because it allows you to
      link a public bitcoin address with a user of your system without exposing
      your private key.
  
      To create a wallet see `bitmerchant.wallet.Wallet`.
  
      After backing up the keys, as detailed in Wallet's docs, give the master
      public key of your wallet as a parameter to this method.
      """
      wallet = Wallet.from_public_key(master_pub_key)
      return wallet.subkey(address_id).bitcoin_address
  
  
  class Wallet(wallet.Wallet):
      def __init__(self, key=None):
          """Create a new BIP32 compliant Wallet.
  
          Args:
              key: The key to use to generate this wallet. It may be a long
                  string. Do not use a phrase from a book or song, as that will
                  be guessed and is not secure. My advice is to not supply this
                  argument and let me generate a new random key for you.
  
          **WARNING**:
  
          When creating a new wallet you MUST back up the private key. If
          you don't then any coins sent to your address will be LOST FOREVER.
  
          You need to save the private key somewhere. It is OK to just write
          it down on a piece of paper! Don't share this key with anyone!
  
              >>> private, public = wallet.get_keys()
              >>> print(private)
          """
          key = key or _random_wallet_key()
          return self.from_master_key(key)
  
      def get_private_key(self):
          """Get the private key for this Wallet.
  
          DO NOT share this private key with anyone. For maximum security you
          should generate this key on a computer not connected to the internet.
          """
          return self.wallet_key(as_private=True)
  
      @classmethod
      def from_private_key(cls, key):
          """Load a Wallet from a private key."""
          w = cls.from_wallet_key(key)
          if not w.is_private:
              raise PrivateKeyException("The provided key is not a private key")
          return w
  
      def get_public_key(self):
          """Get the public key for this wallet.
  
          A public key for a BIP32 wallet allow you to generate new addresses
          without exposing your private key.
          """
          return self.wallet_key(as_private=False)
  
      @classmethod
      def from_public_key(cls, key):
          """Load a Wallet from a public key.
  
          This Wallet will not have the ability to spend coins, but only to
          generate new addresses at which to receive payments.
  
              >>> wallet = Wallet.from_public_key(
              ... u'xpub661MyMwAqRbcFrpiKz9aNJpRkABRXnfREvQqxxya6cdhyGUtx3eRZS'
              ... u'BGXcQgWLg8yY5dpNY2rjwEE6FbXJdqmL37qfkcBNUtbMQfArn7KRg')
              >>> wallet.is_private
              False
          """
          w = cls.from_wallet_key(key)
          if w.is_private:
              raise PublicKeyException("The provided key is a PRIVATE key!")
          return w
  
      def get_keys(self):
          """Get the keys necessary to rebuild this Wallet.
  
          >>> wallet = Wallet(key='correct horse battery staple')
          >>> private, public = wallet.get_keys()
          >>> print(private)
          u'xprv9s21ZrQH143K2mDJW8vDeFwbyDbFv868mM2Zr87rJSTj8q16Unkaq1pryiVYJ3gvoGtazbgKYs1v8rByDYg4LPpQPL6jHjwwhv7DWhWjyXo'  # nopep8
          >>> print(public)
          u'xpub661MyMwAqRbcFFHmcATE1PtLXFRkKaoz8ZxAeWXTrmzi1dLF2L4qNp9LpztfGPdCWGmtAqKbgxNAVKxbNxoosK1aQxS995eweD5vi3sfWnz'  # nopep8
          """
          private = self.get_private_key()
          public = self.get_public_key()
          return private, public
  
  
  class PrivateKeyException(Exception):
      """Exception for problems with a private key."""
  
  
  class PublicKeyException(Exception):
      """Exception for problems with a public key."""
  
subject: Add initial methods and docs