code: def get_adjacency_matrix(self, fmt='coo'):
          r
          # Retrieve existing matrix if available
          if fmt in self._am.keys():
              am = self._am[fmt]
          elif self._am.keys():
              am = self._am[list(self._am.keys())[0]]
              tofmt = getattr(am, 'to'+fmt)
              am = tofmt()
              self._am[fmt] = am
          else:
              am = self.create_adjacency_matrix(weights=self.Ts, fmt=fmt)
              self._am[fmt] = am
          return am
docs: r"""
          Returns an adjacency matrix in the specified sparse format, with 1's
          indicating the non-zero values.
  
          Parameters
          ----------
          fmt : string, optional
              The sparse storage format to return.  Options are:
  
              **'coo'** : (default) This is the native format of OpenPNM data
  
              **'lil'** : Enables row-wise slice of the matrix
  
              **'csr'** : Favored by most linear algebra routines
  
              **'dok'** : Enables subscript access of locations
  
          Notes
          -----
          This method will only create the requested matrix in the specified
          format if one is not already saved on the object.  If not present,
          this method will create and return the matrix, as well as store it
          for future use.
  
          To obtain a matrix with weights other than ones at each non-zero
          location use ``create_adjacency_matrix``.