def byteorder(filename):
    """Check the byteorder of a given file.

    Args:
        filename (str): Filename of a tiff image.

    Returns:
        str: '<' for little endian, '>' for big endian.
    """
    with open(filename, 'rb') as handle:
        tmp = {b'II': '<', b'MM': '>'}[handle.read(2)]
        return tmp
