TODO:
        rob gp "isinstance\\(.*\\\\bstr\\\\b\\)"

def ensure_unicode(str_):
    """
    TODO:
        rob gp "isinstance\\(.*\\\\bstr\\\\b\\)"
    """
    if isinstance(str_, __STR__):
        return str_
    else:
        try:
            return __STR__(str_)
        except UnicodeDecodeError:
            if str_.startswith(codecs.BOM_UTF8):
                # Can safely remove the utf8 marker
                # http://stackoverflow.com/questions/12561063/python-extract-data-from-file
                str_ = str_[len(codecs.BOM_UTF8):]
            return str_.decode('utf-8')