def multiply_constant(c, a):
    """
    Multiplies each element in matrix 'a' by a constant value 'c'.

    :param c:   (int/float) Value to multiply elements in a with.
    :param a:   (list) 2D matrix
    :return:    (list) 2D matrix result of c*a.
    """

    # check argument types
    if (type(c) != float and type(c) != int) or type(a) != list:
        raise TypeError('Error xm13: Incorrect argument type')

    # Return a matrix multiplied by the constant
    return [[a[r][i] * c for i in range(len(a[r]))] for r in range(len(a))]