def scale_bytes(value, units):
    """Convert a value in bytes to a different unit.

    Parameters
    ----------
    value : int
        Value (in bytes) to be converted.
    units : string
        Requested units for output.
        Options: 'bytes', 'kB', 'MB', 'GB', 'TB'

    Returns
    -------
    float
        Value in requested units.
    """
    allowed_units = {'bytes': 1, 'kB': 1024, 'MB': 1048576, 'GB': 
        1073741824, 'TB': 1099511627776}
    if units not in allowed_units:
        raise ValueError('Units must be one of {}'.format(list(
            allowed_units.keys())))
    scale = allowed_units[units]
    return value / scale
