import logging


def remove_rn(reference_node_name):
    """
    Removes the RN from the end of a reference node's name
    :param reference_node_name: node with a reference prefix
    :return: Node with reference prefix removed
    """

    flg = logging.getLogger("lettuce.xgenSetup.remove_rn")

    last_r = reference_node_name.rfind('R')
    rn_removed = reference_node_name[:last_r]

    flg.info("Converting {0} to {1}.".format(reference_node_name, rn_removed))
    return rn_removed