'Matches the command prompt and responds
:arg resp: Byte string containing the raw response from the remote
:arg prompts: Sequence of byte strings that we consider prompts for input
:arg answer: Byte string to send back to the remote if we find a prompt.
A carriage return is automatically appended to this string.
:returns: True if a prompt was found in ``resp``.  False otherwise'

def _handle_prompt(self, resp, prompts, answer):

    prompts = [re.compile(r, re.I) for r in prompts]
    for regex in prompts:
        match = regex.search(resp)
        if match:
            self._shell.sendall(('%s\r' % answer))
            return True
    return False
