code: def truncate(self, length):
          
          if length > len(self.digest):
              raise ValueError("cannot enlarge the original digest by %d bytes"
                               % (length - len(self.digest)))
          return self.__class__(self.func, self.digest[:length])
docs: Return a new `Multihash` with a shorter digest `length`.
  
          If the given `length` is greater than the original, a `ValueError`
          is raised.
  
          >>> mh1 = Multihash(0x01, b'FOOBAR')
          >>> mh2 = mh1.truncate(3)
          >>> mh2 == (0x01, b'FOO')
          True
          >>> mh3 = mh1.truncate(10)
          Traceback (most recent call last):
              ...
          ValueError: cannot enlarge the original digest by 4 bytes