@classmethod
def calculate_amr(cls, is_extended, from_id, to_id, rtr_only=False, rtr_too
    =True):
    """
        Calculates AMR using CAN-ID range as parameter.

        :param bool is_extended: If True parameters from_id and to_id contains 29-bit CAN-ID.
        :param int from_id: First CAN-ID which should be received.
        :param int to_id: Last CAN-ID which should be received.
        :param bool rtr_only: If True only RTR-Messages should be received, and rtr_too will be ignored.
        :param bool rtr_too: If True CAN data frames and RTR-Messages should be received.
        :return: Value for AMR.
        :rtype: int
        """
    return (from_id ^ to_id) << 3 | (7 if rtr_too and not rtr_only else 3
        ) if is_extended else (from_id ^ to_id) << 21 | (2097151 if rtr_too and
        not rtr_only else 1048575)
