code: def sort(self,
               key,
               by=None,
               external=None,
               offset=0,
               limit=None,
               order=None,
               alpha=False,
               store_as=None):
          if order and order not in [b'ASC', b'DESC', 'ASC', 'DESC']:
              raise ValueError('invalid sort order "{}"'.format(order))
          command = [b'SORT', key]
          if by:
              command += [b'BY', by]
          if external and isinstance(external, list):
              for entry in external:
                  command += [b'GET', entry]
          elif external:
              command += [b'GET', external]
          if limit:
              command += [
                  b'LIMIT',
                  ascii(offset).encode('utf-8'),
                  ascii(limit).encode('utf-8')
              ]
          if order:
              command.append(order)
          if alpha is True:
              command.append(b'ALPHA')
          if store_as:
              command += [b'STORE', store_as]
          return self._execute(command)