I have been searching so much to find out what kind of snake this is. It looked black with white stripes. We found it on the Inca Trail to Machu Picchu in Peru. It was about 2500 m above sea level.
EDIT: Apparently M. medemi only exists in Colombia, not in Peru. Thus, as I'm not sure about the below ID. Instead of deleting the answer (users with <10k cannot see it), I just turned this into a community wiki, so I don't receive any RP.
By the shape of the head and the structure of the rings, it seems to me that this is a Micrurus.
Of course, the lack of yellow/red rings excludes the most common coral species, like Micrurus peruvianus. So, I'd guess this is a Micrurus medemi.
Here is another picture of it, for comparison:
Some M. medemi specimens have white rings (like in your photo) while some have red rings.
They are venomous, but they are not dangerous: all Micrurus species I'm aware of are not aggressive, and bites are not common. As Wikipedia correctly says:
When confronted by humans, coral snakes will almost always attempt to flee, and bite only as a last resort.
The problem with this ID is that there are reports of M. medemi in Colombia and Ecuador, but not in Peru. I'll keep researching this and update this answer when I find a record (or delete it if I don't).