code: def index(self, sub, *args):
          '''
          Returns index of sub in bytes.
          Raises ValueError if byte is not in bytes and TypeError if can't
          be converted bytes or its length is not 1.
          '''
          if isinstance(sub, int):
              if len(args) == 0:
                  start, end = 0, len(self)
              elif len(args) == 1:
                  start = args[0]
              elif len(args) == 2:
                  start, end = args
              else:
                  raise TypeError('takes at most 3 arguments')
              return list(self)[start:end].index(sub)
          if not isinstance(sub, bytes):
              try:
                  sub = self.__class__(sub)
              except (TypeError, ValueError):
                  raise TypeError("can't convert sub to bytes")
          try:
              return super(newbytes, self).index(sub, *args)
          except ValueError:
              raise ValueError('substring not found'f index(self, sub, *args):
          '''
          Returns index of sub in bytes.
          Raises ValueError if byte is not in bytes and TypeError if can't
          be converted bytes or its length is not 1.
          '''
          if isinstance(sub, int):
              if len(args) == 0:
                  start, end = 0, len(self)
              elif len(args) == 1:
                  start = args[0]
              elif len(args) == 2:
                  start, end = args
              else:
                  raise TypeError('takes at most 3 arguments')
              return list(self)[start:end].index(sub)
          if not isinstance(sub, bytes):
              try:
                  sub = self.__class__(sub)
              except (TypeError, ValueError):
                  raise TypeError("can't convert sub to bytes")
          try:
              return super(newbytes, self).index(sub, *args)
          except ValueError:
              raise ValueError('substring not found')
docs: Returns index of sub in bytes.
          Raises ValueError if byte is not in bytes and TypeError if can't
          be converted bytes or its length is not 1.