'Convert an address to a Function object, and store the mapping in a dict. If the block is known to be part of a
function, just return that function.
:param int addr: Address to convert
:param dict blockaddr_to_function: A mapping between block addresses to Function instances.
:param angr.knowledge.FunctionManager known_functions: Recovered functions.
:return: a Function object
:rtype: angr.knowledge.Function'

def _addr_to_function(self, addr, blockaddr_to_function, known_functions):

    if (addr in blockaddr_to_function):
        f = blockaddr_to_function[addr]
    else:
        is_syscall = self.project._simos.is_syscall_addr(addr)
        n = self.get_any_node(addr, is_syscall=is_syscall)
        if (n is None):
            node = addr
        else:
            node = self._to_snippet(n)
        self.kb.functions._add_node(addr, node, syscall=is_syscall)
        f = self.kb.functions.function(addr=addr)
        blockaddr_to_function[addr] = f
        if (addr in known_functions):
            f.returning = known_functions.function(addr).returning
        else:
            pass
    return f
