def add_tier(self, name, tier_type='<STR_LIT>', number=None):
if number is None:<EOL><INDENT>number = <NUM_LIT:1> if not self.tiers else len(self.tiers)+<NUM_LIT:1><EOL><DEDENT>elif number < <NUM_LIT:1> or number > len(self.tiers):<EOL><INDENT>raise ValueError('<STR_LIT>'.format(len(self.tiers)))<EOL><DEDENT>elif tier_type not in Tier.P_TIERS:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(self.P_TIERS))<EOL><DEDENT>self.tiers.insert(number-<NUM_LIT:1>,<EOL>Tier(self.xmin, self.xmax, name, tier_type))<EOL>return self.tiers[number-<NUM_LIT:1>]<EOL>
Add an IntervalTier or a TextTier on the specified location.

        :param str name: Name of the tier, duplicate names is allowed.
        :param str tier_type: Type of the tier.
        :param int number: Place to insert the tier, when ``None`` the number
            is generated and the tier will be placed on the bottom.
        :returns: The created tier.
        :raises ValueError: If the number is out of bounds.