def python_to_euc(uni_char, as_bytes=False):
    """
    Return EUC character from a Python Unicode character.

    Converts a one character Python unicode string (e.g. u'\\u4e00') to the
    corresponding EUC hex ('d2bb').
    """
    euc = repr(uni_char.encode('gb2312'))[1:-1].replace('\\x', '').strip("'")
    if as_bytes:
        euc = euc.encode('utf-8')
        assert isinstance(euc, bytes)
    return euc
