def detect_unicode(data):
    """Detect different unicode charsets by looking for BOMs (Byte Order Mark).

    Operate obviously only on `str` objects.
    """
    if data.startswith('ÿþ'):
        return 'utf-16-le'
    elif data.startswith('þÿ'):
        return 'utf-16-be'
    elif data.startswith('ï»¿'):
        return 'utf-8'
    else:
        return None
