def put(self, item, block=True, timeout=None):
self.not_full.acquire()<EOL>try:<EOL><INDENT>if self.maxsize > <NUM_LIT:0>:<EOL><INDENT>if not block:<EOL><INDENT>if self._qsize() == self.maxsize:<EOL><INDENT>raise Full<EOL><DEDENT><DEDENT>elif timeout is None:<EOL><INDENT>while self._qsize() == self.maxsize:<EOL><INDENT>self.not_full.wait()<EOL><DEDENT><DEDENT>elif timeout < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>endtime = _time() + timeout<EOL>while self._qsize() == self.maxsize:<EOL><INDENT>remaining = endtime - _time()<EOL>if remaining <= <NUM_LIT:0.0>:<EOL><INDENT>raise Full<EOL><DEDENT>self.not_full.wait(remaining)<EOL><DEDENT><DEDENT><DEDENT>self._put(item)<EOL>self.unfinished_tasks += <NUM_LIT:1><EOL>self.not_empty.notify()<EOL><DEDENT>finally:<EOL><INDENT>self.not_full.release()<EOL><DEDENT>
Put an item into the queue.

        If optional args 'block' is true and 'timeout' is None (the default),
        block if necessary until a free slot is available. If 'timeout' is
        a non-negative number, it blocks at most 'timeout' seconds and raises
        the Full exception if no free slot was available within that time.
        Otherwise ('block' is false), put an item on the queue if a free slot
        is immediately available, else raise the Full exception ('timeout'
        is ignored in that case).