code: def get_cn(self, structure, n, use_weights=False):
          
  
          siw = self.get_nn_info(structure, n)
          return sum([e['weight'] for e in siw]) if use_weights else len(siw)
docs: Get coordination number, CN, of site with index n in structure.
  
          Args:
              structure (Structure): input structure.
              n (integer): index of site for which to determine CN.
              use_weights (boolean): flag indicating whether (True)
                  to use weights for computing the coordination number
                  or not (False, default: each coordinated site has equal
                  weight).
          Returns:
              cn (integer or float): coordination number.