Beware before you take a voting booth selfie. Taking a photo with a completed ballot is illegal in New York. View Full Caption DNainfo/Jill Colvin

Think before you selfie on Nov. 8.

Taking a photo in a voting booth could very well be illegal in New York City.

Laws restricting photos at the polls vary from state to state — as Justin Timberlake found after he Instagramed a photo of himself in a Tennessee voting booth Monday to encourage early voting (he's since taken the photo down).

In New York state, the law stipulates that "any person who ... makes or keeps any memorandum of anything occurring within the booth, or directly or indirectly, reveals to another the name of any candidate voted for by such voter; or shows his ballot after it is prepared for voting, to any person so as to reveal the contents ... is guilty of a misdemeanor."

READ MORE:

► Here's What You Need to Know Before You Vote on Nov. 8

► What To Do If You're Told You Can't Vote on Election Day

That covers selfies taken inside the voting booth with completed ballots in the frame, or "ballot selfies."

New York state law prohibits the photography of filled-out ballots and the display of such images in the interest of preventing vote buying and coercion.

In New York, there isn't any actual law forbidding you from taking photos at your polling station, should you want to take a selfie with an "I Voted" sticker, but it is illegal to do anything that "willfully and unlawfully obstructs, hinders or delays, or aids or assists in obstructing or delaying any elector on his way to a registration or polling place, or while he is attempting to register or vote," according to state law.

It falls to the poll workers to determine what kind of behavior that entails and you'll see signs that read, "No Photography Without Permission from the Board of Elections in the City of New York," so we recommend some caution whatever you do with your smartphone camera.