def _literal_to_r_str(value):
    """Convert a python value to a corresponding R string.

    >>> _literal_to_r_str(True)
    "TRUE"
    >>> _literal_to_r_str(6)
    "8"
    >>> _literal_to_r_str("test")
    "'test'"
    """
    _literal_to_str = {True: "TRUE", False: "FALSE", None: "NULL"}
    try:
        return _literal_to_str[value]
    except KeyError:
        # quote a string
        if isinstance(value, str):
            return "'{}'".format(value)
        else:
            return str(value)