def get_pseudos_of_calc(calc):
    """Return a dictionary of pseudos used by a given (pw.x, cp.x) calculation.

    This returns a dictionary ``pseudos`` that can be set in a builder as ``builder.pseudo = pseudos``.

    :param calc: a pw.x or cp.x calculation.
    :return: a dictionary where the key is the kind name and the value is the UpfData object.
    """
    from aiida.common.links import LinkType
    pseudos = {}
    inputs = calc.get_incoming(link_type=LinkType.INPUT_CALC)
    for linkname in inputs.keys():
        if linkname.startswith(calc._get_linkname_pseudo_prefix()):
            multiplekindstring = linkname[len(calc.
                _get_linkname_pseudo_prefix()):]
            pseudos[multiplekindstring] = inputs[linkname]
    return pseudos
