code: def from_nds2(cls, nds2channel):
          
          # extract metadata
          name = nds2channel.name
          sample_rate = nds2channel.sample_rate
          unit = nds2channel.signal_units
          if not unit:
              unit = None
          ctype = nds2channel.channel_type_to_string(nds2channel.channel_type)
          # get dtype
          dtype = {  # pylint: disable: no-member
              nds2channel.DATA_TYPE_INT16: numpy.int16,
              nds2channel.DATA_TYPE_INT32: numpy.int32,
              nds2channel.DATA_TYPE_INT64: numpy.int64,
              nds2channel.DATA_TYPE_FLOAT32: numpy.float32,
              nds2channel.DATA_TYPE_FLOAT64: numpy.float64,
              nds2channel.DATA_TYPE_COMPLEX32: numpy.complex64,
          }.get(nds2channel.data_type)
          return cls(name, sample_rate=sample_rate, unit=unit, dtype=dtype,
                     type=ctype)
docs: Generate a new channel using an existing nds2.channel object