def get_common_basename(paths):
    """ Return common "basename" (or "suffix"; is the last component of path)
    in list "paths".  Or return None if all elements in paths do not share a common last
    component.  Generate an error if any path ends with a slash."""
    if len(paths) == 0:
        return None
    # get suffix  of first element:
    first_path = paths[0]
    first_suffix  = first_path.rsplit('/', 1)[-1]
    assert first_suffix !='', "Invalid path, has trailing slash: %s" % first_path
    match = True
    for path in paths:
        prefix, suffix  = path.rsplit('/', 1)
        assert suffix !='', "Invalid path, has trailing slash: %s" % path        
        if suffix != first_suffix:
            match = False
            break
    if not match:
        # suffixes do not match
        return None
    # suffixes match
    return first_suffix