def subslice(inner, outer, section):
    """helper for rediff  outer is a slice (2-tuple, not an official python slice) in global coordinates  inner is a slice (2-tuple) on that slice  returns the result of sub-slicing outer by inner"""
    if section == 'head':
        return outer[0], outer[0] + inner[0]
    elif section == 'tail':
        return outer[0] + inner[1], outer[1]
    elif section == 'middle':
        return outer[0] + inner[0], outer[0] + inner[1]
    else:
        raise ValueError('section val %s not one of (head,middle,tail)' %
            section)
