def encode_value(value, vr)
      if vr == 'AT'
        bin = encode_tag(value)
      else
        # Make sure the value is in an array:
        value = [value] unless value.is_a?(Array)
        # Get the proper pack string:
        type = vr_to_str(vr)
        # Encode:
        bin = value.pack(type)
        # Add an empty byte if the resulting binary has an odd length:
        bin = "#{bin}#{@pad_byte[vr]}" if bin.length.odd?
      end
      return bin
    end
def encode_value(value, vr)
      if vr == 'AT'
        bin = encode_tag(value)
      else
        # Make sure the value is in an array:
        value = [value] unless value.is_a?(Array)
        # Get the proper pack string:
        type = vr_to_str(vr)
        # Encode:
        bin = value.pack(type)
        # Add an empty byte if the resulting binary has an odd length:
        bin = "#{bin}#{@pad_byte[vr]}" if bin.length.odd?
      end
      return bin
    end
Encodes a value, and if the the resulting binary string has an
 odd length, appends a proper padding byte to make it even length.

 @param [String, Integer, Float, Array] value a formatted value (String, Integer, etc..) or an array of numbers
 @param [String] vr the value representation of data to encode
 @return [String] the encoded binary string