<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_value(self, tag=None, field=None):
 """Generate an integer whose bits are set according to the values of fields in this bit field. All other bits are set to zero. Parameters tag : str Optionally specifies that the value should only include fields with the specified tag. field : str Optionally specifies that the value should only include the specified field. Raises ------ ValueError If a field's value, length or position has not been defined. (e.g. :py:meth:`.assign_fields` has not been called). UnknownTagError If the tag specified using the `tag` argument does not exist. UnavailableFieldError If the field specified using the `field` argument does not exist or is not available. """

        assert not (tag is not None and field is not None), \
            "Cannot filter by tag and field simultaneously."

        selected_fields = self._select_by_field_or_tag(tag, field)

        # Check all selected fields have values defined
        missing_fields_idents = set(selected_fields) - set(self.field_values)
        if missing_fields_idents:
            raise ValueError(
                "Cannot generate value with undefined fields {}.".format(
                    ", ".join("'{}'".format(f)
                              for f in missing_fields_idents)))

        # Build the value
        value = 0
        for identifier, field in iteritems(selected_fields):
            if field.length is None or field.start_at is None:
                raise ValueError(
                    "Field '{}' does not have a fixed size/position.".format(
                        identifier))
            value |= (self.field_values[identifier] <<
                      field.start_at)

        return value