import itertools


def get_common_base(files):
    """Find the common parent base path for a list of files.

    For example, ``["/usr/src/app", "/usr/src/tests", "/usr/src/app2"]``
    would return ``"/usr/src"``.

    :param files: files to scan.
    :type files: ``iterable``
    :return: Common parent path.
    :rtype: str
    """

    def allnamesequal(name):
        """Return if all names in an iterable are equal."""
        return all(n == name[0] for n in name[1:])

    level_slices = zip(*[f.split("/") for f in files])
    tw = itertools.takewhile(allnamesequal, level_slices)
    return "/".join(x[0] for x in tw)