; or (bb) is an offense for which the person has been pardoned or has had civil rights restored (if the law of the applicable jurisdiction provides for the loss of civil rights under such an offense); and (II) the pardon, expungement, or restoration of civil rights does not expressly provide that the person may not ship, transport, possess, or receive firearms. (37) The term received from any court an enhanced hate crime misdemeanor sentence — (A) means a court has imposed a sentence for a misdemeanor under Federal, State, or tribal law— (i) that involves the use or attempted use of physical force, the threatened use of a deadly weapon, or other credible threat to the physical safety of any person; and (ii) based, in whole or in part, on a judicial finding that the conduct of the offender was motivated, in whole or in part, by hate or bias for any reason referred to in paragraph (36)(A)(ii); and (B) does not include— (i) the imposition of a sentence described in subparagraph (A), unless— (I) the person— (aa) was represented by counsel in the case; or (bb) knowingly and intelligently waived the right to counsel in the case; and (II) if the sentence described in subparagraph (A) was imposed in a prosecution for an offense for which a person was entitled to a jury trial in the jurisdiction in which the case was tried— (aa) the case was tried by a jury; or (bb) the person knowingly and intelligently waived the right to have the case tried by a jury, by guilty plea or otherwise; or (ii) the imposition of a sentence described in subparagraph (A) if— (I) (aa) the conviction of the offense for which the sentence was imposed has been expunged or set aside; or (bb) the offense for which the sentence was imposed is an offense for which the person has been pardoned or has had civil rights restored (if the law of the applicable jurisdiction provides for the loss of civil rights under such an offense)