def _resolve_rest_format(mode, user_format):
    """Resolve format of submission to JPred REST interface based on provided mode and user format.

    :param str mode: Submission mode, possible values: `single`, `batch`, `msa`.
    :param str user_format: Submission format, possible values: `raw`, `fasta`, `msf`, `blc`.
    :return: Format for JPred REST interface.
    :rtype: :py:class:`str`
    """
    if user_format == "raw" and mode == "single":
        rest_format = "seq"
    elif user_format == "fasta" and mode == "single":
        rest_format = "seq"
    elif user_format == "fasta" and mode == "msa":
        rest_format = "fasta"
    elif user_format == "msf" and mode == "msa":
        rest_format = "msf"
    elif user_format == "blc" and mode == "msa":
        rest_format = "blc"
    elif user_format == "fasta" and mode == "batch":
        rest_format = "batch"
    else:
        raise ValueError("""Invalid mode/format combination.
        Valid combinations are: --mode=single --format=raw
                                --mode=single --format=fasta
                                --mode=msa    --format=fasta
                                --mode=msa    --format=msf
                                --mode=msa    --format=blc
                                --mode=batch  --format=fasta""")
    return rest_format