'Closes the specified circuit.
:param str circuit_id: id of the circuit to be closed
:param str flag: optional value to modify closing, the only flag available
is \'IfUnused\' which will not close the circuit unless it is unused
:raises: :class:`stem.InvalidArguments` if the circuit is unknown
:raises: :class:`stem.InvalidRequest` if not enough information is provided'

def close_circuit(self, circuit_id, flag=''):

    response = self.msg(('CLOSECIRCUIT    %s    %s' % (circuit_id, flag)))
    stem.response.convert('SINGLELINE', response)
    if (not response.is_ok()):
        if (response.code in ('512', '552')):
            if response.message.startswith('Unknown    circuit    '):
                raise stem.InvalidArguments(response.code, response.message, [circuit_id])
            raise stem.InvalidRequest(response.code, response.message)
        else:
            raise stem.ProtocolError(('CLOSECIRCUIT    returned    unexpected    response    code:    %s' % response.code))
