import uuid


def validate_id_is_uuid(input_id, version=4):
    """Validates provided id is uuid4 format value.

    Returns true when provided id is a valid version 4 uuid otherwise
    returns False.
    This validation is to be used only for ids which are generated by barbican
    (e.g. not for keystone project_id)
    """

    try:
        value = uuid.UUID(input_id, version=version)
    except Exception:
        return False
    return str(value) == input_id