def METHOD_NAME(input='', output='', type='stdout', modes=''):
    '''
    This is a generalized template for creating a single sagews cell.
    - sagews modes:
       * '%auto' → 'a'
       * '%hide' → 'i'
       * '%hideall' → 'o'
    - type:
       * err/ascii: html formatted error or ascii/ansi content
       * stdout: plain text
       * html/md: explicit input of html code or md, as display_data
    '''
    cell = MARKERS['cell'] + uuid() + modes + MARKERS['cell'] + u'\n'
    if type == 'md':
        cell += '%%%s\n' % type
        output = input
    cell += input
    # input is done, now the output part
    if type in ['err', 'ascii']:
        # mangle type of output to html
        type = 'html'
    cell += (u'\n' + MARKERS['output'] + uuid() + MARKERS['output'] +
             json.dumps({
                 type: output,
                 'done': True
             }) + MARKERS['output']) + u'\n'
    return cell