code: def degree_count_fn(source, edge, target, edge_dir, field):
      if field is None:
          target["in_degree"] += 1
          source["out_degree"] += 1
          target["all_degree"] += 1
          source["all_degree"] += 1
      else:
          if edge_dir is "in" or edge_dir is "all":
              target[field] = target[field] + 1
          if edge_dir is "out" or edge_dir is "all":
              source[field] = source[field] + 1
      return (source, edge, target)
  
file_path: turicreate/src/python/turicreate/test/test_graph_compute.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from ..None import SGraph, Edge
  import unittest
  import time
  import pytest
  import sys
label_desc: Use image node_id 1 for calling a global function with example usage: degree_count_fn(source, edge, target, edge_dir, field) and returns: source,  edge,  target