Disable the automatic generation of "submocks"

    Given an input Mock, seals it to ensure no further mocks will be generated
    when accessing an attribute that was not already defined.

    Submocks are defined as all mocks which were created DIRECTLY from the
    parent. If a mock is assigned to an attribute of an existing mock,
    it is not considered a submock.

def seal(mock):
    """Disable the automatic generation of "submocks"

    Given an input Mock, seals it to ensure no further mocks will be generated
    when accessing an attribute that was not already defined.

    Submocks are defined as all mocks which were created DIRECTLY from the
    parent. If a mock is assigned to an attribute of an existing mock,
    it is not considered a submock.
    """
    _frankeinstainize(mock)
    for attr in dir(mock):
        try:
            m = getattr(mock, attr)
        except AttributeError:
            continue
        if not isinstance(m, NonCallableMock):
            continue
        if m._mock_new_parent is mock:
            seal(m)