'Retrieves bytes from the buffer.
Arguments:
want(int): Maximum number of bytes to fetch
Returns:
Data as string
Example:
>>> b = Buffer()
>>> b.add(\'hello\')
>>> b.add(\'world\')
>>> b.get(1)
\'h\'
>>> b.get()
\'elloworld\''

def get(self, want=float('inf')):

    if (want >= self.size):
        data = ''.join(self.data)
        self.size = 0
        self.data = []
        return data
    have = 0
    i = 0
    while (want >= have):
        have += len(self.data[i])
        i += 1
    data = ''.join(self.data[:i])
    self.data = self.data[i:]
    if (have > want):
        extra = data[want:]
        data = data[:want]
        self.data.insert(0, extra)
    self.size -= len(data)
    return data
