def create_signature(public_key, private_key, data, scheme):
<EOL>securesystemslib.formats.ED25519PUBLIC_SCHEMA.check_match(public_key)<EOL>securesystemslib.formats.ED25519SEED_SCHEMA.check_match(private_key)<EOL>securesystemslib.formats.ED25519_SIG_SCHEMA.check_match(scheme)<EOL>public = public_key<EOL>private = private_key<EOL>signature = None<EOL>if scheme == '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>nacl_key = nacl.signing.SigningKey(private)<EOL>nacl_sig = nacl_key.sign(data)<EOL>signature = nacl_sig.signature<EOL><DEDENT>except NameError: <EOL><INDENT>raise securesystemslib.exceptions.UnsupportedLibraryError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>except (ValueError, TypeError, nacl.exceptions.CryptoError) as e:<EOL><INDENT>raise securesystemslib.exceptions.CryptoError('<STR_LIT>'<EOL>'<STR_LIT>' + str(e))<EOL><DEDENT><DEDENT>else: <EOL><INDENT>raise securesystemslib.exceptions.UnsupportedAlgorithmError('<STR_LIT>'<EOL>'<STR_LIT>' + repr(scheme))<EOL><DEDENT>return signature, scheme<EOL>
<Purpose>
  Return a (signature, scheme) tuple, where the signature scheme is 'ed25519'
  and is always generated by PyNaCl (i.e., 'nacl').  The signature returned
  conforms to 'securesystemslib.formats.ED25519SIGNATURE_SCHEMA', and has the
  form:

  '\xae\xd7\x9f\xaf\x95{bP\x9e\xa8YO Z\x86\x9d...'

  A signature is a 64-byte string.

  >>> public, private = generate_public_and_private()
  >>> data = b'The quick brown fox jumps over the lazy dog'
  >>> scheme = 'ed25519'
  >>> signature, scheme = \
      create_signature(public, private, data, scheme)
  >>> securesystemslib.formats.ED25519SIGNATURE_SCHEMA.matches(signature)
  True
  >>> scheme == 'ed25519'
  True
  >>> signature, scheme = \
      create_signature(public, private, data, scheme)
  >>> securesystemslib.formats.ED25519SIGNATURE_SCHEMA.matches(signature)
  True
  >>> scheme == 'ed25519'
  True

<Arguments>
  public:
    The ed25519 public key, which is a 32-byte string.

  private:
    The ed25519 private key, which is a 32-byte string.

  data:
    Data object used by create_signature() to generate the signature.

  scheme:
    The signature scheme used to generate the signature.

<Exceptions>
  securesystemslib.exceptions.FormatError, if the arguments are improperly
  formatted.

  securesystemslib.exceptions.CryptoError, if a signature cannot be created.

<Side Effects>
  nacl.signing.SigningKey.sign() called to generate the actual signature.

<Returns>
  A signature dictionary conformat to
  'securesystemslib.format.SIGNATURE_SCHEMA'.  ed25519 signatures are 64
  bytes, however, the hexlified signature is stored in the dictionary
  returned.