title: Using abstract base classes to specify an interface enforcing input and return types
body: <p>I want to write an abstract base class that should enforce that its derived classes implement one method with specific parameters and specific returns. </p>
  
  <p>However, since in Python you specify neither the return type nor the argument types in the method's signature, how can I enforce such an interface?</p>
  
  <p>For example:</p>
  
  <pre><code>class BaseClass(ABC):
  
      @abstractmethod
      def __call__(self, image, labels=None):
          pass
  </code></pre>
  
  <p>I want derived classes to have to implement the <code>__call__()</code> method such that it accepts as arguments a 3D Numpy array (<code>image</code>) and, optionally, a 2D Numpy array (<code>labels</code>), and that it returns a 3D Numpy array (the transformed image) and, once again optionally, a 2D Numpy array (the transformed labels).</p>
  
  <p>How can I enforce, for example, that the <code>__call__()</code> method in a derived class must return exactly that (a 3D Numpy array and, optionally, a 2D Numpy array)?</p>