def directory_to_samples(directory, flags=None):
    samples = []
    targets = []
    label = 0
    classes = sorted(os.walk(directory).next()[1])
    for c in classes:
        c_dir = os.path.join(directory, c)
        for sample in os.walk(c_dir).next()[2]:
            if not flags or any(flag in sample for flag in flags):
                    samples.append(os.path.join(c_dir, sample))
                    targets.append(label)
        label += 1
    return samples, targets


# ------------------
# OTHERS
# ------------------
Parse a PEM-format key.
dataset/ETHPy150Open tflearn/tflearn/tflearn/data_utils.py/directory_to_samples--crossover with--dataset/ETHPy150Open CollabQ/CollabQ/vendor/gdata/tlslite/utils/keyfactory.py/parsePEMKey