docs: def get_mask(self, tag=None, field=None):
          """Get the mask for all fields which exist in the current bit field.
  
          Parameters
          ----------
          tag : str
              Optionally specifies that the mask should only include fields with
              the specified tag.
          field : str
              Optionally specifies that the mask should only include the
              specified field.
  
          Raises
          ------
          ValueError
              If a field's 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.
          """
          if tag is not None and field is not None:
              raise TypeError("get_mask() takes exactly one keyword argument, "
                              "either 'field' or 'tag' (both given)")
  
          selected_fields = self._select_by_field_or_tag(tag, field)
  
          # Build the mask (and throw an exception if we encounter a field
          # without a fixed size/length.
          mask = 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))
              mask |= ((1 << field.length) - 1) << field.start_at
  
          return mask