# Path: torext/utils.py
# def split_kwargs(kwgs_tuple, kwgs):
#     _kwgs = {}
#     for i in kwgs_tuple:
#         if i in kwgs:
#             _kwgs[i] = kwgs.pop(i)
#     return _kwgs
# 
# Path: torext/compat.py
# def unicode_(s, *args):
#     return unicode(s, *args)
# 
# def decode_(s, *args):
#     return s.decode(*args)


import sys
import logging
        import curses
from torext.utils import split_kwargs
from torext.compat import unicode_ as u_, decode_
    from nose.plugins.logcapture import MyMemoryHandler
        """
        return log in unicode
        """
        self._format_record(record)

        record_dict = {}
        for k, v in record.__dict__.items():
            if isinstance(k, str):
                k = decode_(k, 'utf8')
            if isinstance(v, str):
                v = decode_(v, 'utf8', 'replace')
            record_dict[k] = v

        if 'color' in self.fmt or 'end_color' in self.fmt:
            record_dict['color'], record_dict['end_color'] = _color(record.levelno)

        log = self.ufmt % record_dict

        if record.exc_text:
            if log[-1:] != '\n':
                log += '\n'
            log += decode_(record.exc_text, 'utf8', 'replace')

        log = log.replace('\n', '\n' + self.tab)

        return log


class BaseStreamHandler(logging.StreamHandler):
    def __init__(self, *args, **kwgs):

# Path: torext/utils.py
# def split_kwargs(kwgs_tuple, kwgs):
#     _kwgs = {}
#     for i in kwgs_tuple:
#         if i in kwgs:
#             _kwgs[i] = kwgs.pop(i)
#     return _kwgs
# 
# Path: torext/compat.py
# def unicode_(s, *args):
#     return unicode(s, *args)
# 
# def decode_(s, *args):
#     return s.decode(*args)


# Path: torext/log.py
import sys
import logging
        import curses
from torext.utils import split_kwargs
from torext.compat import unicode_ as u_, decode_
    from nose.plugins.logcapture import MyMemoryHandler

        """
        return log in unicode
        """
        self._format_record(record)

        record_dict = {}
        for k, v in record.__dict__.items():
            if isinstance(k, str):
                k = decode_(k, 'utf8')
            if isinstance(v, str):
                v = decode_(v, 'utf8', 'replace')
            record_dict[k] = v

        if 'color' in self.fmt or 'end_color' in self.fmt:
            record_dict['color'], record_dict['end_color'] = _color(record.levelno)

        log = self.ufmt % record_dict

        if record.exc_text:
            if log[-1:] != '\n':
                log += '\n'
            log += decode_(record.exc_text, 'utf8', 'replace')

        log = log.replace('\n', '\n' + self.tab)

        return log


class BaseStreamHandler(logging.StreamHandler):
    def __init__(self, *args, **kwgs):

        _kwgs = split_kwargs(