def get_formula(phenotype, covars, interaction):
    """Creates the linear/logistic regression formula (for statsmodel).

    Args:
        phenotype (str): the phenotype column
        covars (list): the list of co variable columns
        interaction (str): the interaction column

    Returns:
        str: the formula for the statistical analysis

    Note
    ----
        The phenotype column needs to be specified. The list of co variables
        might be empty (if no co variables are necessary). The interaction
        column can be set to ``None`` if there is no interaction.

    """
    formula = '{} ~ _GenoD'.format(phenotype)
    if len(covars) > 0:
        formula += ' + ' + ' + '.join(covars)
    if interaction is not None:
        formula += ' + _GenoD*{}'.format(interaction)
    return formula
