Meet the Man Who Was Stranded as a Shark Lurked Nearby, Just Like Blake Lively in 'The Shallows'

Andy Dehart accidentally attracted a bull shark while spearfishing in the Bahamas.

In her new movie The Shallows, Blake Lively plays a surfer attacked by a huge shark.

Bleeding and battered, she manages to clamber onto a tiny reef but the tide rises, and the shark circles as the rocky refuge sinks into the water.

Read: Sharks and Recreation: Discovery Channel's Shark Week Is Back With a Vengeance

Shark expert Andy Dehart has first-hand knowledge of Lively's plight, as he was once forced to take refuge from a shark on a rocky outcrop.

Dehart, a consultant on Discovery's “Shark Week,” — which starts Sunday — found himself in a similar situation while spearfishing in the Bahamas.

“We unknowingly attracted a big bull shark,” he told Inside Edition. “The shark started smelling blood, and what we did is, there's a very similar situation where there was a limestone outcropping. We hopped up on that and within ten minutes the shark realized there was no food to be had, and swam off peacefully.”

Dehart, who is with The Frost Museum of Science in Miami, has some tips for swimmers confronted by an aggressive shark.

“Make direct eye contact with the shark, keep your face forward to it and keep an eye on it at all times. Don't splash around a lot,” he advises.

Read: We're Gonna Need a Bigger GoPro: Spearfisherman Captures Shark Attack in Vivid Footage

He added: “One of the urban myths about defending yourself is punching a shark in the nose. That is true. All of their sensory organs are up in their nose, up in their snout. You need to be really sure the shark is about to bite you before you do that because right under their nose is their mouth, full of very sharp teeth.”

Dehart also advises against swimming at dusk and dawn — prime feeding times for the sea predators..

Watch: Diver Straddles Shark To Untangle It From Rope