code: def to_binary(self, copy=False):
          
          if self.vartype is Vartype.BINARY:
              if copy:
                  return self.copy()
              else:
                  return self
  
          new = BinaryPolynomial({}, Vartype.BINARY)
  
          # s = 2x - 1
          for term, bias in self.items():
              for t in map(frozenset, powerset(term)):
                  newbias = bias * 2**len(t) * (-1)**(len(term) - len(t))
  
                  if t in new:
                      new[t] += newbias
                  else:
                      new[t] = newbias
  
          return new
docs: Return a binary polynomial over `{0, 1}` variables.
  
          Args:
              copy (optional, default=False):
                  If True, the returned polynomial is always a copy. Otherwise,
                  if the polynomial is binary-valued already it returns itself.
  
          Returns:
              :obj:`.BinaryPolynomial`