'Creates a binary file with the given content.
If content is given as a Unicode string, it is first converted to bytes
character by character. All characters with ordinal below 256 can be
used and are converted to bytes with same values. Using characters
with higher ordinal is an error.
Byte strings, and possible other types, are written to the file as is.
If the directory for the file does not exist, it is created, along
with missing intermediate directories.
Examples:
| Create Binary File | ${dir}/example.png | ${image content}     |
| Create Binary File | ${path}            | \x01\x00\xe4\x00 |
Use `Create File` if you want to create a text file using a certain
encoding. `File Should Not Exist` can be used to avoid overwriting
existing files.
New in Robot Framework 2.8.5.'

def create_binary_file(self, path, content):

    if is_unicode(content):
        content = bytes(bytearray((ord(c) for c in content)))
    path = self._write_to_file(path, content)
    self._link("Created    binary    file    '%s'.", path)
