In IMAP, each command sent by the client is prepended with a
alphanumeric tag like 'A1234'. The server sends the response
to the client command as lines, and the last line in the response
is prepended with the same tag, and it contains the status of
the command completion ('OK', 'NO' or 'BAD').
Sometimes the server sends alerts and response lines from other
commands before sending the tagged line, so this method just
reads all the responses until it encounters $tag.
It returns the tagged line to be processed by the calling method.
If $response is specified, then it will not read the response
from the server before searching for $tag in $response.
Before calling this method, a connection to the IMAP server must be
established.