code: def _create_alias_map(im, alias=None):
      r
      # -------------------------------------------------------------------------
      # Get alias if provided by user
      phases_num = sp.unique(im * 1)
      phases_num = sp.trim_zeros(phases_num)
      al = {}
      for values in phases_num:
          al[values] = 'phase{}'.format(values)
      if alias is not None:
          alias_sort = dict(sorted(alias.items()))
          phase_labels = sp.array([*alias_sort])
          al = alias
          if set(phase_labels) != set(phases_num):
              raise Exception('Alias labels does not match with image labels '
                              'please provide correct image labels')
      return al
docs: r"""
      Creates an alias mapping between phases in original image and identifyable
      names. This mapping is used during network extraction to label
      interconnection between and properties of each phase.
  
      Parameters
      ----------
      im : ND-array
          Image of porous material where each phase is represented by unique
          integer. Phase integer should start from 1. Boolean image will extract
          only one network labeled with True's only.
  
      alias : dict (Optional)
          A dictionary that assigns unique image label to specific phase.
          For example {1: 'Solid'} will show all structural properties associated
          with label 1 as Solid phase properties.
          If ``None`` then default labelling will be used i.e {1: 'Phase1',..}.
  
      Returns
      -------
      A dictionary with numerical phase labels as key, and readable phase names
      as valuies. If no alias is provided then default labelling is used
      i.e {1: 'Phase1',..}