<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_array(self, array, propname):
 r""" Apply data to the network based on a rectangular array filled with values. Each array location corresponds to a pore in the network. Parameters array : array_like The rectangular array containing the values to be added to the network. This array must be the same shape as the original network. propname : string The name of the pore property being added. """

        array = sp.atleast_3d(array)
        if sp.shape(array) != self._shape:
            raise Exception('The array shape does not match the network')
        temp = array.flatten()
        Ps = sp.array(self['pore.index'][self.pores('internal')], dtype=int)
        propname = 'pore.' + propname.split('.')[-1]
        self[propname] = sp.nan
        self[propname][self.pores('internal')] = temp[Ps]