'Writes a usage line into the buffer.
:param prog: the program name.
:param args: whitespace separated list of arguments.
:param prefix: the prefix for the first line.'

def write_usage(self, prog, args='', prefix='Usage:    '):

    usage_prefix = ('%*s%s    ' % (self.current_indent, prefix, prog))
    text_width = (self.width - self.current_indent)
    if (text_width >= (term_len(usage_prefix) + 20)):
        indent = ('    ' * term_len(usage_prefix))
        self.write(wrap_text(args, text_width, initial_indent=usage_prefix, subsequent_indent=indent))
    else:
        self.write(usage_prefix)
        self.write('\n')
        indent = ('    ' * (max(self.current_indent, term_len(prefix)) + 4))
        self.write(wrap_text(args, text_width, initial_indent=indent, subsequent_indent=indent))
    self.write('\n')
