import binascii
import colorsys


def generate_bgcolor(str):
    """Generate an arbitrary background color based on a hash of 'str'."""
    crc = binascii.crc32(str.encode('utf-8')) % (1 << 32)
    # pick out some HSV
    h = (crc & 0xFF) / 255.0
    s = ((crc & 0xFF00) >> 8) / 255.0
    v = ((crc & 0xFF0000) >> 16) / 255.0
    # make sure value is high, saturation is low
    s = (s / 4) + 0.25
    v = (v / 4) + 0.75
    return ('#%02x%02x%02x' % tuple([int(x*255) for x in colorsys.hsv_to_rgb(h, s, v)]))