<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def x509_from_ecdsap256_key_pair(pub_key, priv_key, common_name):
 """ Creates a self-signed x509 certificate for a common name and ECDSAP256 key pair. :pub_key: an ECDSAP256PublicKey instance :priv_key: an ECDSAP256PrivateKey instance :common_name: an XTTIdentity instance :returns: the certificate as a byte string """

    cert_len = _lib.xtt_x509_certificate_length()
    cert = _ffi.new('unsigned char[]', cert_len)
    rc = _lib.xtt_x509_from_ecdsap256_keypair(pub_key.native,
                                           priv_key.native,
                                           common_name.native,
                                           cert, len(cert))
    if rc == RC.SUCCESS:
        return _ffi.buffer(cert)[:]
    else:
        raise error_from_code(rc)