def HImass2flux(m_hi, D):
    """
    Converts HI masses into observed fluxes, depending on the distance

    Input
    -----
    M : float or ndarray
        HI mass in solar masses
    D : float
        Distance in Mpc
    Returns
    -------
    S : Flux in Jy km/s

    """
    S = m_hi / 2.36e5 / D**2

    return S