docs: def _setauto(self, s, length, offset):
          """Set bitstring from a bitstring, file, bool, integer, array, iterable or string."""
          # As s can be so many different things it's important to do the checks
          # in the correct order, as some types are also other allowed types.
          # So basestring must be checked before Iterable
          # and bytes/bytearray before Iterable but after basestring!
          if isinstance(s, Bits):
              if length is None:
                  length = s.len - offset
              self._setbytes_unsafe(s._datastore.rawbytes, length, s._offset + offset)
              return
          if isinstance(s, file):
              if offset is None:
                  offset = 0
              if length is None:
                  length = os.path.getsize(s.name) * 8 - offset
              byteoffset, offset = divmod(offset, 8)
              bytelength = (length + byteoffset * 8 + offset + 7) // 8 - byteoffset
              m = MmapByteArray(s, bytelength, byteoffset)
              if length + byteoffset * 8 + offset > m.filelength * 8:
                  raise CreationError("File is not long enough for specified "
                                      "length and offset.")
              self._datastore = ConstByteStore(m, length, offset)
              return
          if length is not None:
              raise CreationError("The length keyword isn't applicable to this initialiser.")
          if offset:
              raise CreationError("The offset keyword isn't applicable to this initialiser.")
          if isinstance(s, basestring):
              bs = self._converttobitstring(s)
              assert bs._offset == 0
              self._setbytes_unsafe(bs._datastore.rawbytes, bs.length, 0)
              return
          if isinstance(s, (bytes, bytearray)):
              self._setbytes_unsafe(bytearray(s), len(s) * 8, 0)
              return
          if isinstance(s, array.array):
              b = s.tostring()
              self._setbytes_unsafe(bytearray(b), len(b) * 8, 0)
              return
          if isinstance(s, numbers.Integral):
              # Initialise with s zero bits.
              if s < 0:
                  msg = "Can't create bitstring of negative length {0}."
                  raise CreationError(msg, s)
              data = bytearray((s + 7) // 8)
              self._datastore = ByteStore(data, s, 0)
              return
          if isinstance(s, collections.Iterable):
              # Evaluate each item as True or False and set bits to 1 or 0.
              self._setbin_unsafe(''.join(str(int(bool(x))) for x in s))
              return
          raise TypeError("Cannot initialise bitstring from {0}.".format(type(s)))