code: def linearize_aliases(self):
          # type: () -> typing.List[Alias]
          
          linearized_aliases = []
          seen_aliases = set()  # type: typing.Set[Alias]
  
          def add_alias(alias):
              # type: (Alias) -> None
              if alias in seen_aliases:
                  return
              elif alias.namespace != self:
                  return
              if is_alias(alias.data_type):
                  add_alias(alias.data_type)
              linearized_aliases.append(alias)
              seen_aliases.add(alias)
  
          for alias in self.aliases:
              add_alias(alias)
  
          return linearized_aliases
docs: Returns a list of all aliases used in the namespace. The aliases are
          ordered to ensure that if they reference other aliases those aliases
          come earlier in the list.