def Jy2K(S, theta, lam):
    """
    Convert Jansky/beam to Kelvin, taken from
    https://science.nrao.edu/facilities/vla/proposing/TBconv

    S: Flux in Jy/beam
    theta: FWHM of the telescope in radians
    lam: Wavelength of the observation in m

    Returns: Brightness temperature in K

    """
    return 0.32e-3 * lam**2. / theta**2. * S