def METHOD_NAME(data):
    """Encode data based on platform."""
    if isinstance(data, str):
        if sys.platform == "win32":
            data = data.replace("\n", "\r\n")
        data = data.encode("utf-8")
    return data