def METHOD_NAME(
        client, librarian_martigny, lib_martigny,
        item_on_loan_martigny_patron_and_loan_on_loan, loc_public_martigny,
        item2_on_loan_martigny_patron_and_loan_on_loan,
        circulation_policies):
    """Test the frontend return a checked-out item action."""
    # test passes when all required parameters are given
    login_user_via_session(client, librarian_martigny.user)
    item, patron, loan = item_on_loan_martigny_patron_and_loan_on_loan
    # test fails when there is a missing required parameter
    res, data = postdata(
        client,
        'api_item.checkin',
        dict(
            item_pid=item.pid
        )
    )
    assert res.status_code == 400
    # test fails when there is a missing required parameter
    res, data = postdata(
        client,
        'api_item.checkin',
        dict(
            item_pid=item.pid,
            transaction_location_pid=loc_public_martigny.pid
        )
    )
    assert res.status_code == 400
    # test fails when there is a missing required parameter
    # when item record not found in database, api returns 404
    res, data = postdata(
        client,
        'api_item.checkin',
        dict(
            transaction_location_pid=loc_public_martigny.pid,
            transaction_user_pid=librarian_martigny.pid
        )
    )
    assert res.status_code == 404
    # test passes when the transaction location pid is given
    res, data = postdata(
        client,
        'api_item.checkin',
        dict(
            item_pid=item.pid,
            transaction_location_pid=loc_public_martigny.pid,
            transaction_user_pid=librarian_martigny.pid
        )
    )
    assert res.status_code == 200
    item = Item.get_record_by_pid(item.pid)
    assert item.status == ItemStatus.ON_SHELF
    # test passes when the transaction library pid is given
    item, patron, loan = item2_on_loan_martigny_patron_and_loan_on_loan
    res, data = postdata(
        client,
        'api_item.checkin',
        dict(
            item_pid=item.pid,
            transaction_library_pid=lib_martigny.pid,
            transaction_user_pid=librarian_martigny.pid
        )
    )
    assert res.status_code == 200
    item = Item.get_record_by_pid(item.pid)
    assert item.status == ItemStatus.ON_SHELF