# Filtering a Package

`quilt3` provides a handful of functions for operating on the contents of a package in an entry-by-entry manner. These are helpful for performing more complicated parsing operations on the package:

```python
import quilt3

# create a package
p = (quilt3.Package()
        .set_dir("dict", "/usr/share/dict/")
        .set("words", "/usr/share/dict/words"))

# element-wise transform entries, outputting a list
# here "lk" is shorthand for "logical_key"
# and "entry" is the package entry
p.map(lambda lk, entry: entry)

# filter out entries not meeting certain criteria
p.filter(lambda lk, entry: 'cool' not in lk)
```

Notice that these functions operate over `(logical_key, entry)` tuples. Each `logical_key` is a string. Each `entry` is `PackageEntry` object, as would be returned if you slice to a leaf node of the package (e.g. `p['bar']`).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.quilt.bio/quilt-python-sdk/advanced/filtering-a-package.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
