def __getitem__(self, key):

        returned = None
        if isinstance(key, slice):
            if key.step:
                if key.start:
                    returned = Batch.return_string(key.start)
                    self.commands += \
                        'COMMIT RETRY {}\nRETURN {}'.format(key.step, returned)
                else:
                    self.commands += 'COMMIT RETRY {}'.format(key.step)
            elif key.stop:
                # No commit.

                if Batch.clean_name:
                    return self.variables[Batch.clean_name(key.stop)]
                elif any(c in Batch.INVALID_CHARS for c in key.stop):
                    raise ValueError(
                        'Variable name \'{}\' contains invalid character(s).'
                            .format(key.stop))

                return self.variables[key.stop]
            else:
                if key.start:
                    returned = Batch.return_string(key.start)
                    self.commands += 'COMMIT\nRETURN {}'.format(returned)
                else:
                    self.commands += 'COMMIT'
        else:
            returned = Batch.return_string(key)
            self.commands += 'COMMIT\nRETURN {}'.format(returned)

        g = self.graph
        if returned:
            response = g.client.batch(self.commands)
            self.clear()

            if returned[0] in ('[','{'):
                return g.elements_from_records(response) if response else None
            else:
                return g.element_from_record(response[0]) if response else None
        else:
            g.client.batch(self.commands)
            self.clear()
This downloads and installs a specific version of a package.
dataset/ETHPy150Open mogui/pyorient/pyorient/ogm/batch.py/Batch.__getitem__--crossover with--dataset/ETHPy150Open lektor/lektor/lektor/packages.py/download_and_install_package