def directory_in_zip(zip_f, directory_name):

    """Determine if a directory exists in a ZIP"""

    return any(x.startswith("%s/" % directory_name.rstrip("/"))
               for x in zip_f.namelist())