<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _expand_vrf_spec(self, spec):
 """ Expand VRF specification to SQL. id [integer] internal database id of VRF name [string] name of VRF A VRF is referenced either by its internal database id or by its name. Both are used for exact matching and so no wildcard or regular expressions are allowed. Only one key may be used and an error will be thrown if both id and name is specified. """


        if type(spec) is not dict:
            raise NipapInputError("vrf specification must be a dict")

        allowed_values = ['id', 'name', 'rt']
        for a in spec:
            if a not in allowed_values:
                raise NipapExtraneousInputError("extraneous specification key %s" % a)

        if 'id' in spec:
            if type(spec['id']) not in (int, long):
                raise NipapValueError("VRF specification key 'id' must be an integer.")
        elif 'rt' in spec:
            if type(spec['rt']) != type(''):
                raise NipapValueError("VRF specification key 'rt' must be a string.")
        elif 'name' in spec:
            if type(spec['name']) != type(''):
                raise NipapValueError("VRF specification key 'name' must be a string.")
        if len(spec) > 1:
            raise NipapExtraneousInputError("VRF specification contains too many keys, specify VRF id, vrf or name.")

        where, params = self._sql_expand_where(spec, 'spec_')

        return where, params