code: def get_network_mappings(network_id, network_2_id=None, **kwargs):
      
      qry = db.DBSession.query(ResourceAttrMap).filter(
          or_(
              and_(
                  ResourceAttrMap.resource_attr_id_a == ResourceAttr.id,
                  ResourceAttr.network_id == network_id),
              and_(
                  ResourceAttrMap.resource_attr_id_b == ResourceAttr.id,
                  ResourceAttr.network_id == network_id)))
  
      if network_2_id is not None:
          aliased_ra = aliased(ResourceAttr, name="ra2")
          qry = qry.filter(or_(
              and_(
                  ResourceAttrMap.resource_attr_id_a == aliased_ra.id,
                  aliased_ra.network_id == network_2_id),
              and_(
                  ResourceAttrMap.resource_attr_id_b == aliased_ra.id,
                  aliased_ra.network_id == network_2_id)))
  
      return qry.all()
docs: Get all the mappings of network resource attributes, NOT ALL THE MAPPINGS
          WITHIN A NETWORK. For that, ``use get_mappings_in_network``. If another network
          is specified, only return the mappings between the two networks.