def _to_mbcs(s):
    """try encode string using mbcs"""
    enc = getattr(s, 'encode', None)
    if enc is not None:
        try:
            s = enc('mbcs')
        except UnicodeError:
            pass
    return s
