'Read one line, using raw_input when available.'

def getline(self, prompt):

    if (self.input is sys.stdin):
        return raw_input(prompt)
    else:
        self.output.write(prompt)
        self.output.flush()
        return self.input.readline()
