<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sfs(dac, n=None):
 """Compute the site frequency spectrum given derived allele counts at a set of biallelic variants. Parameters dac : array_like, int, shape (n_variants,) Array of derived allele counts. n : int, optional The total number of chromosomes called. Returns ------- sfs : ndarray, int, shape (n_chromosomes,) Array where the kth element is the number of variant sites with k derived alleles. """


    # check input
    dac, n = _check_dac_n(dac, n)

    # need platform integer for bincount
    dac = dac.astype(int, copy=False)

    # compute site frequency spectrum
    x = n + 1
    s = np.bincount(dac, minlength=x)

    return s