Certain penalties are required by law depending on the offense. If a penalty is not required by law, there is always an opportunity to negotiate around it.
Even if you plan to plead guilty, a good defense lawyer will present your side of the story in a way that garners empathy from the DA and the judge, and minimizes the potential penalty. This means showing mitigating facts relevant to the incident itself, and demonstrating the good character of the client. All of these factors can help.