<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def proj(vec, vec_onto):
 """ Vector projection. Calculated as: .. math:: \\mathsf{vec\\_onto} * \\frac{\\mathsf{vec}\\cdot\\mathsf{vec\\_onto}} {\\mathsf{vec\\_onto}\\cdot\\mathsf{vec\\_onto}} Parameters vec length-R |npfloat_| -- Vector to project vec_onto length-R |npfloat_| -- Vector onto which `vec` is to be projected Returns ------- proj_vec length-R |npfloat_| -- Projection of `vec` onto `vec_onto` """


    # Imports
    import numpy as np

    # Ensure vectors
    if not len(vec.shape) == 1:
        raise ValueError("'vec' is not a vector")
    ## end if
    if not len(vec_onto.shape) == 1:
        raise ValueError("'vec_onto' is not a vector")
    ## end if
    if not vec.shape[0] == vec_onto.shape[0]:
        raise ValueError("Shape mismatch between vectors")
    ## end if

    # Calculate the projection and return
    proj_vec = np.float_(np.asscalar(np.dot(vec.T, vec_onto))) / \
                np.float_(np.asscalar(np.dot(vec_onto.T, vec_onto))) * vec_onto
    return proj_vec