def _validate_metadata(name, description, featurestore_settings):
    """
    Function for validating metadata when creating new feature groups and training datasets.
    Raises and assertion exception if there is some error in the metadata.

    Args:
        :name: the name of the feature group/training dataset
        :description: the description
        :featurestore_regex: Regex string to match featuregroup/training dataset and feature names with

    Returns:
        None

    Raises:
        :ValueError: if the metadata does not match the required validation rules
    """
    if not featurestore_settings.featurestore_regex.match(name):
        raise ValueError(
            'Illegal feature store entity name, the provided name {} is invalid. Entity names can only contain lower case characters, numbers and underscores and cannot be longer than {} characters or empty.'
            .format(name, featurestore_settings.entity_name_max_len))
    if description:
        if len(description) > featurestore_settings.entity_description_max_len:
            raise ValueError(
                'Illegal feature store entity description, the provided description for the entity {} is too long with {} characters. Entity descriptions cannot be longer than {} characters.'
                .format(name, len(description), featurestore_settings.
                entity_description_max_len))
