<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def directives(entrystream, type=None):
 """ Pull directives out of the specified entry stream. :param entrystream: a stream of entries :param type: retrieve only directives of the specified type; set to :code:`None` to retrieve all directives """

    for directive in entry_type_filter(entrystream, tag.Directive):
        if not type or type == directive.type:
            yield directive