Edit: sorry this is NYC law
(p) Bicycles.
(1) Bicycle riders to use bicycle lanes. Whenever a usable path or lane for bicycles
has been provided, bicycle riders shall use such path or lane only except under any of
the following situations:
(i) When preparing for a turn at an intersection or into a private road or driveway.
(ii) When reasonably necessary to avoid conditions (including but not limited to,
fixed or moving objects, motor vehicles, bicycles, pedestrians, pushcarts,
animals, surface hazards) that make it unsafe to continue within such bicycle
path or lane.