def get_length(data):
    """Return torrent length in bytes"""
    length = 0
    if 'files' in data['info']:
        for file in data['info']['files']:
            length += file['length']
    else:
        length += data['info']['length']
    return length