def maybe_encode(value):
    """If the value passed in is a str, encode it as UTF-8 bytes for Python 3

    :param str|bytes value: The value to maybe encode
    :rtype: bytes

    """
    try:
        return value.encode('utf-8')
    except __HOLE__:
        return value
dataset/ETHPy150Open gmr/consulate/consulate/utils.py/maybe_encode