Can I unlock my iPhone if I have a contract with less than 6 months?

If it is possible, Normally about 35-50% of iPhones can get unlocked even before 6 months, but it’s not 100% sure as if it was out of contract.