def validate(user):
    """Check the user.

    :param user: A user object
    :return: A validated user object
    :raises ValueError: When user property is invalid
    """
    if not user:
        raise ValueError("User cannot be empty.")

    if not user.name:
        raise ValueError("Missing user name.")

    enrollment = user.enrollment
    if not enrollment:
        raise ValueError("Missing user enrollment.")

    if not enrollment.cert:
        raise ValueError("Missing user enrollment cert.")

    if not enrollment.private_key:
        raise ValueError("Missing user enrollment key.")

    if not user.msp_id:
        raise ValueError("Missing msp id.")

    if not user.cryptoSuite:
        raise ValueError("Missing crypto suite.")

    return user