code: def get_degrees(self):
          '''
          API:
              get_degree(self)
          Description:
              Returns degrees of nodes in dictionary format.
          Return:
              Returns a dictionary of node degrees. Keys are node names, values
              are corresponding degrees.
          '''
          degree = {}
          if self.attr['type'] is not DIRECTED_GRAPH:
              for n in self.get_node_list():
                  degree[n] = len(self.get_neighbors(n))
              return degree
          else:
              for n in self.get_node_list():
                  degree[n] = (len(self.get_in_neighbors(n)) +
                               len(self.get_out_neighbors(n))f get_degrees(self):
          '''
          API:
              get_degree(self)
          Description:
              Returns degrees of nodes in dictionary format.
          Return:
              Returns a dictionary of node degrees. Keys are node names, values
              are corresponding degrees.
          '''
          degree = {}
          if self.attr['type'] is not DIRECTED_GRAPH:
              for n in self.get_node_list():
                  degree[n] = len(self.get_neighbors(n))
              return degree
          else:
              for n in self.get_node_list():
                  degree[n] = (len(self.get_in_neighbors(n)) +
                               len(self.get_out_neighbors(n)))
docs: API:
              get_degree(self)
          Description:
              Returns degrees of nodes in dictionary format.
          Return:
              Returns a dictionary of node degrees. Keys are node names, values
              are corresponding degrees.