<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def build_collision_table(aliases, levels=COLLISION_CHECK_LEVEL_DEPTH):
 """ Build the collision table according to the alias configuration file against the entire command table. self.collided_alias is structured as: { 'collided_alias': [the command level at which collision happens] } For example: { 'account': [1, 2] } This means that 'account' is a reserved command in level 1 and level 2 of the command tree because lvl 1 lvl 2 Args: levels: the amount of levels we tranverse through the command table tree. """

        collided_alias = defaultdict(list)
        for alias in aliases:
            # Only care about the first word in the alias because alias
            # cannot have spaces (unless they have positional arguments)
            word = alias.split()[0]
            for level in range(1, levels + 1):
                collision_regex = r'^{}{}($|\s)'.format(r'([a-z\-]*\s)' * (level - 1), word.lower())
                if list(filter(re.compile(collision_regex).match, azext_alias.cached_reserved_commands)) \
                        and level not in collided_alias[word]:
                    collided_alias[word].append(level)

        telemetry.set_collided_aliases(list(collided_alias.keys()))
        return collided_alias