import re


def _process_code_both(script_data):
    """Converts to python a pyshell script that has ` symbol both in the beginning of expression and in the end.
    An example would be:
    f = `echo 1`

    :param script_data: the string of the whole script
    :return: the shellpy script converted to intermediate form
    """
    code_both_pattern = re.compile(r'([a-z]*)`(.*?)`')
    new_script_data = code_both_pattern.sub(r'both_shexe(\2)shexe(\1)shexe', script_data)
    return new_script_data