def __getitem__(self, source):
<EOL>if not isinstance(source, type):<EOL><INDENT>source = source.__class__<EOL><DEDENT>if source in self.sources:<EOL><INDENT>return self.sources[source]<EOL><DEDENT>for klass in source.mro()[<NUM_LIT:1>:]:  <EOL><INDENT>try:<EOL><INDENT>result = self.sources[klass]<EOL><DEDENT>except KeyError:<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>if result.allow_subclasses:<EOL><INDENT>return result<EOL><DEDENT><DEDENT><DEDENT>raise SourceNotFound(self, source)<EOL>
Get the ``Source`` instance for the given source class.

        Arguments
        ---------
        source : object
            The source to fetch in the registry dictionary.
            It may be an instance of a class, in which case its class will be used.
            It may be a subclass of a class in the registry, and if this one was registered
            with ``allow_subclasses`` set to ``True``, this class will be used.

        Returns
        -------
        Source
            The ``Source`` instance from the registry that matches the given source.

        Raises
        ------
        dataql.solvers.exceptions.SourceNotFound
            If the given source is not in the registry.

        Example
        -------

        >>> from datetime import date, datetime
        >>> registry = Registry()
        >>> registry.register(date, ['year', 'month', 'day'])
        >>> registry[date]
        <Source 'datetime.date'>
        >>> registry[date.today()]
        <Source 'datetime.date'>
        >>> registry[datetime]
        <Source 'datetime.date'>
        >>> registry = Registry()
        >>> registry.register(date, ['year', 'month', 'day'],allow_subclasses=False)
        >>> registry[datetime] # doctest: +ELLIPSIS
        Traceback (most recent call last):
        dataql.solvers.exceptions.SourceNotFound: The `datetime.datetime` source is not...