def _to_bytes(str_bytes):
    """Takes UTF-8 string or bytes and safely spits out bytes"""
    try:
        bytes = str_bytes.encode('utf8')
    except AttributeError:
        return str_bytes
    return bytes