'Initialize a tokenizer instance.
@param f: The file to tokenize.  The default is sys.stdin.
This parameter may also be a string, in which case the tokenizer
will take its input from the contents of the string.
@type f: file or string
@param filename: the name of the filename that the L{where} method
will return.
@type filename: string'

def __init__(self, f=sys.stdin, filename=None):

    if isinstance(f, str):
        f = cStringIO.StringIO(f)
        if (filename is None):
            filename = '<string>'
    elif (filename is None):
        if (f is sys.stdin):
            filename = '<stdin>'
        else:
            filename = '<file>'
    self.file = f
    self.ungotten_char = None
    self.ungotten_token = None
    self.multiline = 0
    self.quoting = False
    self.eof = False
    self.delimiters = _DELIMITERS
    self.line_number = 1
    self.filename = filename
