import copy


def scal_opstr(a, op):
    """Add prefactor to operator string

    Arguments:
        * ``a``: Scalar prefactor.
        * ``op``: Operator string.

    Returns:
        Rescaled operator string. Effectively, the matrix elements of the first element of \
        the operator string are multiplied by ``a``.

    """

    newOp = [copy.deepcopy(o) for o in op]
    newOp[0]['matEls'] = a * newOp[0]['matEls']
    return tuple(newOp)