<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def put(self, task):
 """ Inserts a Task into the queue :param task: :class:`~redisqueue.AbstractTask` instance :return: Boolean insert success state :exception: ConnectionError if queue is not connected """


        if not self.connected:
            raise QueueNotConnectedError("Queue is not Connected")

        if task.unique:
            # first lets check if we have this hash already in our queue
            if not self.__db.sismember(self._lock_key, task.unique_hash()):
                self.__db.sadd(self._lock_key, task.unique_hash())
            else:
                raise TaskAlreadyInQueueException(
                    'Task already in Queue [{hash}]'.format(
                        hash=task.unique_hash()))

        self.__db.lpush(self._key, task.to_json())

        return True