You are charged with misdemeanor petty theft which carries a maximum sentence of six months in the county jail and/or a fine of $1,000. If what you took is worth less than $50 the prosecutor can charge it as either a misdemeanor or an infraction. Since the value of what you took is right on the dividing line between an infraction and petty theft you should use a lawyer to tryto get it reduced to an infraction under PC 490.1. Although this may seem a small matter it is a crime of dishonesty and, if charged as a misdemeanor, will stay on your criminal record and interfere with future job searches and professional licenses. It is worth paying a lawyer to help you structure the best solution. I handle many such cases in SF, know the judges and the prosecutors and would be happy to give you a free consultation. You may call my office at 415-753-1889.
Mr Kaman has provided you with sage advice and a sound assessment of the situation you are faced with. If you are anywhere near him you would be well served by accepting his willingness to consult on this matter. Good luck.
DISCLAIMER I do not practice law in your State. This answer is provided for informational purposes only. This answer does not constitute legal advice, create an attorney-client relationship, or constitute attorney advertising.