def tablefromascii(tablename, asciifile,
                   headerfile='',
                   autoheader=False, autoshape=[],
                   columnnames=[], datatypes=[],
                   sep=' ',
                   commentmarker='',
                   firstline=1, lastline=-1,
                   readonly=True,
                   lockoptions='default', ack=True):
    import os.path
    filename = os.path.expandvars(asciifile)
    filename = os.path.expanduser(filename)
    if not os.path.exists(filename):
        s = "File '%s' not found" % (filename)
        raise IOError(s)
    if headerfile != '':
        filename = os.path.expandvars(headerfile)
        filename = os.path.expanduser(filename)
        if not os.path.exists(filename):
            s = "File '%s' not found" % (filename)
            raise IOError(s)
    tab = table(asciifile, headerfile, tablename, autoheader, autoshape,
                sep, commentmarker, firstline, lastline,
                _columnnames=columnnames, _datatypes=datatypes, _oper=1)
    six.print_('Input format: [' + tab._getasciiformat() + ']')
    tab = 0
    return table(tablename, readonly=readonly, lockoptions=lockoptions,
                 ack=ack)