code: function getRelationshipsOf(model, iterator) {
          var i,
              len,
              ref,
              refs = getRefsTo(model),
              results = [];
  
          function _add(rel) {
              if (!_.contains(results, rel)) {
                  results.push(rel);
              }
          }
  
          for (i = 0, len = refs.length; i < len; i++) {
              ref = refs[i];
  
              // for DirectedRelationship
              if ((ref instanceof Core.DirectedRelationship) && (ref.source === model || ref.target === model)) {
                  if (iterator) {
                      if (iterator(ref)) {
                          _add(ref);
                      }
                  } else {
                      _add(ref);
                  }
              }
  
              // for UndirectedRelationship
              if ((ref instanceof Core.RelationshipEnd) && (ref.reference === model)) {
                  if (iterator) {
                      if (iterator(ref._parent)) {
                          _add(ref._parent);
                      }
                  } else {
                      _add(ref._parent);
                  }
              }
          }
          return results;
      }
docs: Return all instances of Relationship connected to the given model element.
  @param {Core.Model} model Model element.
  @param {?function(Element):boolean} iterator if given, returns instances only satisfying iterator function.
  @return {Array<Core.Model>} Instances of Relationship.