code: def from_str(cls, s):
          
          if not isinstance(s, str):
              raise TypeError("Expected an str instance, received %r" % (s,))
          return cls(cls.bits_from_str(s))
docs: Accepts both the output of to_simple_str() and __str__().