<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_n_ref(self, fill=0, dtype='i1'):
 """Transform each genotype call into the number of reference alleles. Parameters fill : int, optional Use this value to represent missing calls. dtype : dtype, optional Output dtype. Returns ------- out : ndarray, int8, shape (n_variants, n_samples) Array of ref alleles per genotype call. Notes ----- By default this function returns 0 for missing genotype calls **and** for homozygous non-reference genotype calls. Use the `fill` argument to change how missing calls are represented. Examples -------- array([[2, 1], [1, 0], [0, 0]], dtype=int8) array([[ 2, 1], [ 1, 0], [ 0, -1]], dtype=int8) <GenotypeVector shape=(3, 2) dtype=int64> 0/0 0/2 2/2 array([2, 1, 0], dtype=int8) """


        # count number of alternate alleles
        out = np.empty(self.shape[:-1], dtype=dtype)
        np.sum(self.values == 0, axis=-1, out=out)

        # fill missing calls
        if fill != 0:
            m = self.is_missing()
            out[m] = fill

        # handle mask
        if self.mask is not None:
            out[self.mask] = fill

        return out