<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def optional_data_directories(self):
 """ Data directories entries are somewhat wierd. First of all they have no direct type information in it, the type is assumed from the position inside the table. For this reason there are often "null" entries, with all fields set to zero. Here we parse all the entries, assign the correct type via position and then filter out the "null" ones. Even if the algorithm itself if quite simple, figuring it required a huge amount of time staring at PE/COFF specification with a 8O like expression thinking "WTF? WTF! WTF? WHY?!" """

        base_offset = self.pe_header_offset +\
            COFF_Header.get_size() +\
            OptionalHeader_StandardFields.get_size() +\
            OptionalHeader_WindowsFields.get_size()

        for i in range(0, self.optional_windows_fields.NumberOfRvaAndSizes):
            offset = base_offset + i*OptionalHeader_DataDirectory.get_size()
            header = OptionalHeader_DataDirectory(self.stream, offset, i)

            if not header.is_empty():
                yield header