title: Return class instance instead of creating a new one if already existing
body: <p>I defined a class named <code>Experiment</code> for the results of some lab experiments I am conducting. The idea was to create a sort of database: if I add an experiment, this will be pickled to a db before at exit and reloaded (and added to the class registry) at startup.</p>
  
  <p>My class definition is:</p>
  
  <pre><code>class IterRegistry(type):
      def __iter__(cls):
          return iter(cls._registry)
  
  
  class Experiment(metaclass=IterRegistry):
      _registry = []
      counter = 0
  
      def __init__(self, name, pathprotocol, protocol_struct, pathresult, wallA, wallB, wallC):
          hashdat = fn.hashfile(pathresult)
          hashpro = fn.hashfile(pathprotocol)
          chk = fn.checkhash(hashdat)
          if chk:
              raise RuntimeError("The same experiment has already been added")
          self._registry.append(self)
          self.name = name
          [...]
  </code></pre>
  
  <p>While <code>fn.checkhash</code> is a function that checks the hashes of the files containing the results:</p>
  
  <pre><code>def checkhash(hashdat):
      for exp in cl.Experiment:
          if exp.hashdat == hashdat:
              return exp
      return False
  </code></pre>
  
  <p>So that if I add a previously added experiment, this won't be overwritten.</p>
  
  <p>Is it possible to somehow return the existing instance if already existant instead of raising an error? (I know in <code>__init__</code> block it is not possible)</p>