<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def where_entry_category(query, category, recurse=False):
 """ Generate a where clause for a particular category """


    category = str(category)
    if category and recurse:
        # We're recursing and aren't in /, so add the prefix clause
        return orm.select(
            e for e in query
            if e.category == category or e.category.startswith(category + '/')
        )

    if not recurse:
        # We're not recursing, so we need an exact match on a possibly-empty
        # category
        return orm.select(e for e in query if e.category == category)

    # We're recursing and have no category, which means we're doing nothing
    return query