mandamus legal basis