@classmethod
def get_connection(cls, connection_name=None, pymongo=False):
    """
        Get a connection, return None if the specified connection hasn't been 
        created.

        :Parameters:
          - `connection_name(optional)`: The connection name. If not set it 
            will return the current connection.
          - `pymongo(optional)`: If true it will return an instance of 
            :class:`~pymongo.MongoClient` or :class:`~pymongo.MongoReplicaSetClient` 
            otherwise :class:`~motor.MotorClient` or :class:`~motor.MotorReplicaSetClient`.
        """
    if connection_name is None:
        connection_name = cls._default_connection
    for connection in cls._connections:
        if connection_name in connection.keys():
            return connection[connection_name][1 if pymongo else 0]
    return None
