def dictify(df, key: str, value: str) -> dict:
    """Builds a dictionary using two columns of a Pandas DataFrame.

    # Arguments
        df: DataFrame, dataframe
        key: str, column name
        value: str, column name

    # Returns
        dict: key value mapping

    >>> dictify(pd.DataFrame({"A": [0, 1], "B": ["x", "y"]}), "A", "B")
    {0: 'x', 1: 'y'}
    """
    try:
        return {k: v for k, v in zip(df[key], df[value])}
    except KeyError as err:
        err.args = ((f"`{err.args[0]}` is not a valid key or value.",
                     f"Must be in: {set(df.columns)}"))
        raise