(1) Except as provided in paragraph (2), the judicial officer shall order that a person who has been found guilty of an offense and sentenced to a term of imprisonment, and who has filed an appeal or a petition for a writ of certiorari, be detained, unless the judicial officer finds
(A) by clear and convincing evidence that the person is not likely to flee or pose a danger to the safety of any other person or the community if released under section
3142 (b) or (c) of this title; and
(B) that the appeal is not for the purpose of delay and raises a substantial question of law or fact likely to result in
(i) reversal,
(ii) an order for a new trial,
(iii) a sentence that does not include a term of imprisonment, or
(iv) a reduced sentence to a term of imprisonment less than the total of the time already served plus the expected duration of the appeal process.
If the judicial officer makes such findings, such judicial officer shall order the release of the person in accordance with section 3142 (b) or (c) of this title, except that in the circumstance described in subparagraph (B)(iv) of this paragraph, the judicial officer shall order the detention terminated at the expiration of the likely reduced sentence.