def debug_filename(pe):
    """
    Extract filename from a PE file
    """
    if hasattr(pe, 'DIRECTORY_ENTRY_DEBUG'):
        for i in pe.DIRECTORY_ENTRY_DEBUG:
            if hasattr(i.entry, 'PdbFileName'):
                return i.entry.PdbFileName.decode('utf-8', 'ignore')
    return None
