def items_in_this_page(ls_resp, mode=None):
    """
    Returns a dictionary of data record and/or collections from the given
    listing response from DataFed

    Parameters
    ----------
    ls_resp : protobuf message
        Message containing the listing reply
    mode : str, optional
        Set to "d" to only get datasets from the listing
        Set to "c" to only get collections from the listing
        Leave unset for all items in the listing

    Returns
    -------
    dict
        Keys are IDs and values are the title for the object
    """
    data_objects = dict()

    if not mode:
        # return everything - records and collections
        for item in ls_resp[0].item:
            data_objects[item.title] = item.id
    else:
        for item in ls_resp[0].item:
            # return only those that match with the mode (dataset / collection)
            if item.id.startswith(mode):
                data_objects[item.title] = item.id

    return data_objects