<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def encrypt(s, pk, pk_format=SER_COMPACT, mac_bytes=10, curve=None):
 """ Encrypts `s' for public key `pk' """

    curve = (Curve.by_pk_len(len(pk)) if curve is None
             else Curve.by_name(curve))
    p = curve.pubkey_from_string(pk, pk_format)
    return p.encrypt(s, mac_bytes)