'Issues a single AT command to the modem, and returns the relevant
part of the response. This only works for commands that return a
single line followed by "OK", but conveniently, this covers almost
all AT commands that I\'ve ever needed to use.
For all other commands, returns None.'

def query(self, cmd, prefix=None):

    out = self.command(cmd)
    if ((len(out) == 2) and (out[(-1)] == 'OK')):
        if (prefix is None):
            return out[0].strip()
        elif (out[0][:len(prefix)] == prefix):
            return out[0][len(prefix):].strip()
    return None
