def avp_by_code(code, vendor = 0)
      avps = all_avps_by_code(code, vendor)
      if avps.empty?
        nil
      else
        avps[0]
      end
    end
def avp_by_code(code, vendor = 0)
      avps = all_avps_by_code(code, vendor)
      if avps.empty?
        nil
      else
        avps[0]
      end
    end
@private
 Prefer AVP.define and the by-name versions to this

 Returns the first AVP with the given code and vendor. Only covers "top-level"
 AVPs - it won't look inside Grouped AVPs.

 @param code [Fixnum] The AVP Code
 @param vendor [Fixnum] Optional vendor ID for a vendor-specific
   AVP.
 @return [AVP] if there is an AVP with that code/vendor
 @return [nil] if there is not an AVP with that code/vendor