code: def AverageGatewayDegree_metric(bpmn_graph):
      
  
      gateways_ids = [gateway[0] for gateway in get_all_gateways(bpmn_graph)]
      all_nodes_degrees = bpmn_graph.diagram_graph.degree()
      gateways_degree_values = [all_nodes_degrees[gateway_id] for gateway_id in gateways_ids]
  
      return float(sum(gateways_degree_values)) / float(len(gateways_degree_values))
docs: Returns the value of the Average Gateway Degree metric
      ("Average of the number of both incoming and outgoing arcs of the gateway nodes in the process model")
      for the BPMNDiagramGraph instance.
  
      :param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.