import warnings


def checkups(params, formulas):
    """
    Checks if the user has given an available distribution, too many formulas or wrong parameters for the given distribution.

    Parameters
    ----------
        params : list of strings
            A list of strings of the parameters of the current distribution.
        formulas : dictionary
            A dictionary with keys corresponding to the parameters of the distribution defined by the user and values to strings 
            defining the formula for each distribution, e.g. formulas['loc'] = '~ 1 + spline(x1, bs="bs", df=9) + dm1(x2)'.
            
    Returns
    -------
        new_formulas : dictionary
            If the current distribution is available in the list of families, new_formulas holds a formula for each parameter of 
            the distribution.
            If a formula hasn't been given for a parameter, ~0 formula is set. If the current distribution is not available, 
            an empty dictionary is returned.  
    """
    new_formulas=dict()
    for param in params:
        if param in formulas:
            new_formulas[param] = formulas[param]
        # define an empty formula for parameters for which the user has not specified a formula
        else:
            warnings.simplefilter('always')
            warnings.warn(f'Parameter formula f{param} for distribution not defined. Creating a zero formula for it.', stacklevel=2)
            new_formulas[param] = '~0'
    return new_formulas