@pytest.fixture
def mock_profile_builder():
    counter = itertools.count()
    next(counter)
    username_to_profile = {}

    def _build_mock_profile(username='username', age=30, id=None,
                            location='San Francisco, CA', **kwargs):
        if username in username_to_profile:
            return username_to_profile[username]
        if id is None:
            id = next(counter)
        mock_profile = mock.MagicMock(id=id or next(counter), location=location,
                                      age=age, username=username, **kwargs)
        username_to_profile[username] = mock_profile
        return mock_profile

    return _build_mock_profile
dataset/ETHPy150Open IvanMalison/okcupyd/okcupyd_testing/conftest.py/mock_profile_builder/original