docs: def set_privkey_compressed(privkey, compressed=True):
      """
      Make sure the private key given is compressed or not compressed
      """
      if len(privkey) != 64 and len(privkey) != 66:
          raise ValueError("expected 32-byte private key as a hex string")
  
      # compressed?
      if compressed and len(privkey) == 64:
          privkey += '01'
  
      if not compressed and len(privkey) == 66:
          if privkey[-2:] != '01':
              raise ValueError("private key does not end in '01'")
  
          privkey = privkey[:-2]
  
      return privkey