code: def calculate_amr(cls, is_extended, from_id, to_id, rtr_only=False, rtr_too=True):
          
          return (((from_id ^ to_id) << 3) | (0x7 if rtr_too and not rtr_only else 0x3)) if is_extended else \
              (((from_id ^ to_id) << 21) | (0x1FFFFF if rtr_too and not rtr_only else 0xFFFFF))
docs: 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