def _printf(fmt, *args, **print3opts):
    '''Formatted print to sys.stdout or given stream.

        *print3opts* -- print keyword arguments, like Python 3.+
    '''
    if print3opts:  # like Python 3.0
        f = print3opts.get('file', None) or sys.stdout
        if args:
            f.write(fmt % args)
        else:
            f.write(fmt)
        f.write(print3opts.get('end', linesep))
        if print3opts.get('flush', False):
            f.flush()
    elif args:
        print(fmt % args)
    else:
        print(fmt)
Formatted print to sys.stdout or given stream.

        *print3opts* -- print keyword arguments, like Python 3.+
    
recipes/Python/546530_Size_of_Python_objects_revised/recipe-546530.py