def GetID(attrs, tag, val):
    """
    handy method which pulls out a nested id: attrs refers to a dictionary holding the id
    tag refers to the tag we're looking at (e.g measure, part etc)
    val refers to the exact index of the tag we're looking for (e.g number, id etc)
    example case: attrs = self.attribs, tag=measure and val=number would
    return current measure number
    """

    if tag in attrs:
        if val in attrs[tag]:
            return attrs[tag][val]